SUMMARY: How to get a K01script to run?

From: Judith Reed <jreed_at_wukon.appliedtheory.com>
Date: Wed, 03 Jun 1998 11:37:21 -0400

Thanks to all for the many quick, helpful responses.

Whitney Latta describes the behavior most concisely:
"The problem most likely relates to "how" you shut down the system.
The shutdown(8) command does not invoke the "K" scripts in the various
/sbin/rc?.D directories when going down. It sends out broadcast kill
signals. These scripts are run by the init process when it transitions
from one run level to another, as controlled by the entries in
/etc/inittab file.
You might try executing the command "init 0", to transition to run-level
0, and the kill scripts will be executed."

Tom Webster comments:
"The only way to get the system to use the scripts
with shutdown is to not use any switches, then it will run the scripts
and take the system down to single user mode. (Big help if you are remote.)
Another option is to run "shutdown -k" to send out the warning messages
and then manually run "init 0" to halt the system, which will use the
initscripts."
He further notes that this is supposed to be fixed in DU 5.0.

Others questioned the numbering of the script and the run level directory
it was in - /sbin/rc0.d/K01oracle - indicating that perhaps it should be in
/sbin/rc2.d since the startup script is in /sbin/rc3.d, and that it should
be numbered higher, as at that low number other things will have been stopped
before it. I looked at /sbin/rc0, and it appears that the lower numbered
items should run first - observe:

if [ -d /sbin/rc0.d ]; then
        # Kill procedures
        for f in /sbin/rc0.d/K*
        do
                if [ -s $f ]; then
                        /sbin/sh $f stop
                fi
        done

but it's not clear what directory the kill procedure should be in. However, I
tested using "init 0" with our /sbin/rc0.d/K01oracle script, and oracle was
shutdown cleanly, so evidently that number/directory combo works.

It also was noted that you can shell-debug a script with "sh -x script".
The script does work when run manually, however, so we are reasonably sure
it is the shutdown issue.

Thanks again...
-- 
Judith Reed
jreed_at_appliedtheory.com
Received on Wed Jun 03 1998 - 17:38:51 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:37 NZDT