Recently we had some trouble getting a startup script to work correctly on our intranet Centos 5 linux box.
It seemed to run fine when the command was invoked on the bash prompt but fail at startup. After a little digging, it turns out that the script required mysqld to be running; however it had been installed to run before the mysqld process had started – so it FAILED!
This led me to the next problem of how to change the ordering inside the run levels. Well to do that I needed to understand what set the level during installation.
It turns out that the command chkconfig is the command which is used to install the script, and it looks inside the script being installed for a comment like the following:
# chkconfig: 66 45
The first number is the priority for startup and the second number is the priority for shutdown.
If your script was zabbix_server (as ours was) you might try and install it as follows:
chkconfig --level 0 zabbix_server off chkconfig --level 35 zabbix_server on
Now if we do a quick look in the /etc/rc0.d folder and /etc/rd3.d folders for zabbix like scripts you can see the following:
First looking for shutdown scripts (note the use of K for KILL!)
[root@zabbixserver ~]# ls /etc/rc0.d | grep '.*zabbix_server*' K45zabbix_server
And taking a slice at the rc3.d folder we can see
[root@xnet ~]# ls /etc/rc3.d | tail -n 20 | head -n 10 S55zabbix_agentd S56cups S56rawdevices S56xinetd S64mysqld S66zabbix_server S80sendmail S85gpm S90crond S90xfs
Shows that the S (START) position for zabbix_server is now S66 right after mysqld at S64 as we require.
The moral of the story for me I guess is to understand when installing software how the startup/shutdown scripts are created and check they are compatible with your hosts runlevels by thinking about there dependencies during installation. We only noticed by observing startup failure.
A really great linux article explaining the linux boot process can be found here



