Joined: 16 Mar 2006
|Posted: Wed Mar 26, 2008 3:52 pm Post subject: Why RedHat does not stop in rc0.d and rc6.d ...
|The reason is ...
RedHat checks for a lock file for your script in /var/lock/subsys/<scriptname>
For example, lets say you created a script to shutdown your application in: /etc/init.d/SomeApp
And you created symbolic links to this script in /etc/rc.d/rc0.d/ and /etc/rc.d/rc6.d/ such as:
/etc/rc.d/rc0.d/K04SomeApp -> ../init.d/SomeApp
In order for your script to work, it must create the lock file in the start section.
if test "$1" = "start"
elif test "$1" = "stop"
The 'touch' command is the critical line in the code above.
It is the one that /etc/rc.d/rc is looking for here:
snippet from RedHat rc system script:
# First, run the KILL scripts.
for i in /etc/rc$runlevel.d/K* ; do
check_runlevel "$i" || continue
# Check if the subsystem is already up.
[ -f /var/lock/subsys/$subsys -o -f /var/lock/subsys/$subsys.init ] \
# Bring the subsystem down.
if egrep -q "(killproc |action )" $i ; then
action $"Stopping $subsys: " $i stop
rc scripts not shutting down
rc.0 rc.6 K* not working
stop start with runlevels redhat