/ETC/INIT.D point to/etc/rc.d/init.d directory
. In addition to calling scripts directly (such as/ETC/RC.D/INIT.D/XINETD), you can also use service commands to control services such as INIT.D restart (systemctl restart JWs) under the directory
Here, let's explain what's in the INIT.D. This directory contains scripts that are typically startup scripts for some of the services that Linux has set up to install with RPM packages. The system is installed in a lot of RPM packages, where there are many corresponding scripts. Executing these scripts can be used to start, stop, and restart these services.
As mentioned earlier, the/ETC/RC.D/INIT.D script in this directory is similar to the registry in Windows, which executes when the system starts. The program runs here (the Init process reads the runlevel), and I believe that from a named point of view you can guess the script that runs/ETC/RC.D/INIT.D, or why it's also called Init (. D). Yes, it's time to run the script in the INIT.D, but not directly, but selectively because the system doesn't need to start all of the services.
So, how does the system choose which needs to start and what not? At this point, the level of operation that was just said worked.
After the system-initiated run level is determined, the/ETC/RC.D/RC script executes first. In the source code of RH9 and FC7 it is a check_runlevel (although the implementation of the code is not the same, but also the same), after knowing the RunLevel, for each runlevel, under the RC.D have a subdirectory is rc0.d,rc1.d .... Rc6.d. Each directory is a subset of the scripts to the INIT.D directory for some links. Each level to perform which services in the corresponding directory, such as Level 5 to start the service is placed under the RC5.D, but placed under this rc5.d are some linked files, linked to INIT.D in the corresponding file, the real work of INIT.D script.
Here, I think everyone may be more clear, I began to believe that this is the case. But then I looked closely and compared the filenames of these linked files and the scripts that were actually executed in the INIT.D, and there were a few questions that didn't make sense. By the chance to write this article, I have done some homework, and finally I have probably solved the doubts.
1. Why do these linked files bring a kxx or sxx?
Yes, with the K-Stop (Kill) a service, s means to open (start)
2, K and s behind the number? What's the use?
I thought it was a good arrangement or a count (isn't it naïve?). )。 Later found not. It is used to sort, that is, to determine the order of execution of these scripts, the value of small first execution, the value of large after execution. Most of the time these execution order is very important, such as to start the Apache service, you must first configure the network interface, or a non-IP machine to start the HTTP service it is not very funny ...
3, inadvertently I found the same service with S and with k link to Init.d is the same script. I wonder why the same script is executed?
This time is really the magic of S and K, the original S and K and not only for the look of the clear. s give and K are also passed the start and stop parameters to the script below Init.d. Oh, that's it (Huanran dawu look, hehe)! Then I think of the original once countless used/etc/rc.d/init.d/network restart command. The original transmission S is equivalent to the execution of/etc/rc.d/init.d/xxx start this command, of course, K is equivalent to/etc/rc.d/init.d/xxx stop.
The relationship between/etc/rc.d/and/ETC/RC.D/INIT.D