FC2: init script not called at shutdown/reboot

Robert Locke lists at ralii.com
Wed Apr 6 18:30:26 UTC 2005


On Mon, 2005-04-04 at 15:49 -0500, Hegge, Johnathan wrote:
> I wrote/modified a few init scripts, including one for HSQLDB, that I
> have installed w/ chkconfig.  The scripts run fine at startup and work
> well with the "service" command.  I noticed that they are not called at
> shutdown individually, as are sshd, cron, etc.  I have links for them in
> /etc/rc6.d, as configured by chkconfig, but they are not called, instead
> just getting a SIGTERM.  
> 
> I need to shut the database down properly, must I use "killproc" in
> order for them to be processed?  
> 

Couple of things to check....

1) You have a comment line near the beginning of the script that looks
sort of like:

# chkconfig: 345 65 35

BTW, the first number identifies the runlevels to be started in when we
"reset" or "add" the script.  The second number reflects the order that
the script is "started" with - the two digit number following the S.
The third number reflects the order that the script is "killed" with -
the two digit number following K.

2) That you have done a:

chkconfig --add scriptname

This will add the S and K files to all of the seven
directories /etc/rc.d/rc[0-6].d/....

Alternatively, you could do a chkconfig --reset scriptname to verify.

3) Remember that "shutdown -h" runs the stuff from rc0.d and "shutdown -
r" runs the stuff from rc6.d.  Both should have K versions of the
scriptname.

4) Test the logic of your script.  Does the execution of:

service scriptname stop

actually stop your service?  If not, then you need to check the code
following your case statement for "stopping" the service....

5) Lastly, are you implementing a /var/lock/subsys file?  Take a closer
look at some of the existing scripts in /etc/rc.d/init.d/ that are using
"touch" to create a file when the process is started.  This may preclude
the K script from being executed by /etc/rc.d/rc if the file is
missing....

Hope that helps a little,

--Rob




More information about the fedora-list mailing list