Shutdown Scripts

Simper, Brian D plug-discuss@lists.plug.phoenix.az.us
Tue, 7 Jan 2003 10:03:08 -0700


>"Simper, Brian D" wrote:
>>=20
>> I have a short script that I want to run on my Red Hat system at =
every shutdown or=20
>>reboot.  I registered it with chkconfig and placed a symlink at
>>=20
>>         /etc/rc.d/rc6.d/K01run --> ../init.d/run
>>=20
>>It has never run.  The first line of the script writes the command =
line to a log file=20
>>and it consistently runs at start (rc3.d/S95run) but I have never seen =
it operate at=20
>>shutdown and write a "stop" command to the log file.  Does anyone know =
what trick can=20
>>make this work?
>>=20
>> Thanks,
>>=20
>> Brian
>
>I have a similar situation, and I put it in /etc/rc3.d/ and /etc/rc5.d/
>- seems to work ok.

Thanks for your suggestions.  I just wanted to follow up and let you =
know the solution since I learned a lot after doing a little more =
research. =20

The stop scripts in /etc/rc.d/rc6.d (or rc0.d) will not run unless they =
touch a file in /var/lock/subsys.  The 0 length files in =
/var/lock/subsys are markers to show that a service started up correctly =
so it is OK to kill them during shutdown.  Look in /etc/rc.d/init.d/cups =
to see how this is implemented.  The /etc/rc.d/rc script checks if this =
file exists before it allows the shutdown script to run.

Brian