Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-27-2006, 02:02 AM   #1
LQ Newbie
Registered: Apr 2006
Posts: 8

Rep: Reputation: 0
Scripts under rc0.d and rc6.d do not seem to run during shutdown.reboot


I am using RedHat 9 and have problems running scripts that should run during shutdown/reboot.

I placed a script under /etc/init.d/ ('my_script') and made a symbolic link (K40my_script)to it in /etc/rc0.d/ (for shutdown) and /etc/rc6.d/ (for rebooting).

However, when I shutdown/reboot I do not see (during shutdown/reboot on the screen within the list of scripts being run) that my scripts run.

During startup (boot), I do see (on the screen within the list of scripts running) that the script (symbolic link, 'S99my_script' under /etc/rc5.d/) runs.

Does anyone have an idea why my script does not run during shutdown/reboot although it exists as a symbolic link under rc0.d and rc6.d?

Old 04-27-2006, 08:43 AM   #2
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 741Reputation: 741Reputation: 741Reputation: 741Reputation: 741Reputation: 741Reputation: 741
When you put a link in rcX.d, the first letter tells the system to either start (S) or kill (K) the process. If you have K for kill, then I'm not sure you would see anything happening.
Did you want your script to start or kill when re-booting or shutting-down?
Old 04-27-2006, 10:27 AM   #3
LQ Newbie
Registered: Apr 2006
Posts: 8

Original Poster
Rep: Reputation: 0
Shutting down/re-boot and rc0.d / rc6.d

Thank You for your reply.

The scripts aim to stop processes that are running. As such I think they should be 'K'. I also thought that all scripts in rc0.d and rc6.d which are shutdown and re-boot levels should be 'K'. Do you think they may need to be 'S'? What is the meaning of an 'S' script during shutdown (isn't shutdown when you want to kill (and not start) all processes?)

I thought that maybe the scripts do actually run (and I just do not 'see' them run on the console). But then:
a. I get a 'FAIL' on the screen when the system tries to shut down PPP0 (during shutdown) and that proves to me that my script is not running (it is a script that stops my internet cable connection). Had my script run, I expect PPP0 to be shut without failing.

b. If K20mysql exists under rc6.d and during re-boot I see on the screen that the mysql is running (stopping), why would I not see K40my_script run during re-boot (it is also under rc6.d)?

Old 04-13-2007, 06:09 PM   #4
LQ Newbie
Registered: Apr 2007
Posts: 1

Rep: Reputation: 0
the same problem!!!

I have de same problem....and it is growing 'cause any scripts i add to the rc's does not oracle, tuxedo, mqseries, etc.

If you know any solution...please let me know.
i'm running red hat enterprise linux and fedora.....
Old 03-26-2008, 10:34 AM   #5
LQ Newbie
Registered: Mar 2008
Posts: 1

Rep: Reputation: 0
Lightbulb Solution...

The reason RedHat does not kick off your K* rc shutdown scripts is because RedHat checks for a lock file for your script in /var/lock/subsys/<scriptname>

To fix this, simply add a line to your 'start' section, something like this:
touch /var/lock/subsys/<scriptname>
This will create that 0 byte file that rc is looking for when it executes shutdown.

Here is the actual snippet of the code from /etc/rc.d/rc that does this:
# 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 ] \
                || continue

        # Bring the subsystem down.
        if egrep -q "(killproc |action )" $i ; then
                $i stop
                action $"Stopping $subsys: " $i stop

good luck,


reboot, scripts, shutdown

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why won't my FC3 rc0 and rc6 levels not call kill script when entering those levels? dvkwiatk Linux - General 2 11-11-2006 08:09 AM
shutdown scripts? mushmaster Linux - Software 5 02-15-2005 06:23 PM
Want to run a few scripts before KDE shutdown, where can I add them. Brian1 Linux - Software 6 06-16-2004 06:36 PM
How do i make scripts run at bootup and shutdown? BajaNick Linux - General 2 08-11-2003 08:37 PM
The rc0.d and rc6.d files are located were?!? bripage Linux - General 6 07-24-2002 10:39 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:51 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration