Today there is a server that does not start properly because there is a service that does not start up becauseAService needsBThe service starts normally before it starts properly, so you need to adjustA,BThe start order of the service. On the Internet to find some information, summed up, for later needs.
to know the starting order of a service, you need to know how the service started. Linux has 7 runlevel and the user can choose different runlevel. Enter the /etc/rc.d/ directory, you can see the rc0.d to rc6.d from the 7 directories, these directories corresponding to 7 levels.
Into the rc3.d directory, you can see a variety of services starting with K or s ,K means start,s means stop, and the following numbers indicate the boot order. We take the familiar network service as an example, here is just a link, in fact, or point to /etc/init.d/network, its starting value is ten.
in RC?. D is a link file, linked to the script in/ETC/INIT.D.
In the script, there is a #chkconfig line, which describes the startup priority of the script and the shutdown priority when it is set to self-boot.
For example, let's look at the network script:
We can see that the network script is set to self-boot, only in level 2,345 will be self-booting, the boot priority is 10, the shutdown priority is 90. So, if you want to set your own script to start automatically, you need to have this line as well.
This is my script, which is simply to check the status of the network when the script is started and write the results to the Network.res file in TMP.
In the script I set the boot priority to be 9, smaller than the network, which means that when my script starts, the network is not started.
Set my script to start automatically: Chkconfig--add test
Then you can see the link to my script in/etc/rc.d/rc5.d.
Then restart the virtual machine to view the contents of the file under TMP to see the network startup results:
Did not start, to achieve the purpose.
Linux self-Starting service priority/order setting