LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Newbie
User Name
Password
Linux - Newbie This 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!

Notices

Tags used in this thread
Popular LQ Tags , , , , ,

Reply
 
Thread Tools Search this Thread
Old 04-27-2006, 03:02 AM   #1
oferu
LQ Newbie
 
Registered: Apr 2006
Posts: 8
Thanked: 0
Scripts under rc0.d and rc6.d do not seem to run during shutdown.reboot


[Log in to get rid of this advertisement]
Hi,

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?

Thanks
oferu is offline  
Tag This Post , , , , ,
Reply With Quote
Old 04-27-2006, 09:43 AM   #2
pixellany
Moderator
 
Registered: Nov 2005
Location: Pasadena, CA
Distribution: Arch+KDE
Posts: 14,158
Thanked: 380
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?
pixellany is online now     Reply With Quote
Old 04-27-2006, 11:27 AM   #3
oferu
LQ Newbie
 
Registered: Apr 2006
Posts: 8
Thanked: 0

Original Poster
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)?

Thanks.
oferu is offline     Reply With Quote
Old 04-13-2007, 07:09 PM   #4
rogbazan
LQ Newbie
 
Registered: Apr 2007
Posts: 1
Thanked: 0
the same problem!!!

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

If you know any solution...please let me know.
i'm running red hat enterprise linux and fedora.....
rogbazan is offline     Reply With Quote
Old 03-26-2008, 11:34 AM   #5
howtoforums.net
LQ Newbie
 
Registered: Mar 2008
Posts: 1
Thanked: 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:
Code:
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:
Code:
# 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.
        subsys=${i#/etc/rc$runlevel.d/K??}
        [ -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
        else
                action $"Stopping $subsys: " $i stop
        fi
done

good luck,
Jacob
howtoforums.net is offline     Reply With Quote

Reply


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 09:09 AM
shutdown scripts? mushmaster Linux - Software 5 02-15-2005 07:23 PM
Want to run a few scripts before KDE shutdown, where can I add them. Brian1 Linux - Software 6 06-16-2004 07:36 PM
How do i make scripts run at bootup and shutdown? BajaNick Linux - General 2 08-11-2003 09:37 PM
The rc0.d and rc6.d files are located were?!? bripage Linux - General 6 07-24-2002 11:39 AM


All times are GMT -5. The time now is 02:39 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Advertisement
Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Click Here to receive a complimentary subscription courtesy of LQ.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration