LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 05-25-2005, 05:12 PM   #1
dvkwiatk
LQ Newbie
 
Registered: May 2005
Posts: 2

Rep: Reputation: 0
Question Why won't my FC3 rc0 and rc6 levels not call kill script when entering those levels?


I have a script, that will eventually start/stop my oracle services. However, when the machine shuts down/reboots, the command to kill the processes is never invoked. I've removed the actual calls to start and stop the processes to help troubleshoot.

Linux: Fedora Core 3 - latest kernel build

The following script, resides in /etc/init.d with permissions 755 root.root.
I can run this manually and the script executes as expected.
#!/bin/sh
#
# chkconfig: 35 91 35
# description: Startup/Shutdown Oracle Services.
#

logfile=/var/log/oracle.log

case "$1" in
start)
echo "Start" >> $logfile
;;
stop)
echo "Stop" >> $logfile
;;
restart)
echo "Restart" >> $logfile
;;
reload)
echo "Reload" >> $logfile
;;
status)
echo "Status" >> $logfile
;;
condrestart)
echo "Condrestart" >> $logfile
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}"
exit 1
esac

exit 0

So far, I've have used the chkconfig utility and it properly creates the K35oracle and S91oracle in the appropriate run levels. However, when the machine is either rebooted or shutdown the Kill is never invoked.

I have also tried to just create the links myself using ln -s ../init.d/oracle K35oracle in run levels 0 & 6 along with the S in level 5. On startup, the script is always executed and an entry shows in the logfile as expected. I'm probably missing the obvious but if anyone has any ideas I would greatly appreciate your thoughts...

Thanks,
Ed
 
Old 10-30-2006, 01:53 PM   #2
shrewmouse
LQ Newbie
 
Registered: Oct 2006
Posts: 2

Rep: Reputation: 1
The fact that this isn't documented in chkconfig is a real pain in the rear but here's the answer.

/etc/rc is the script responsible for running each script in /etc/rc*.d. Before running each K* script, rc performs the following check.

Code:
        # Check if the subsystem is already up.
        subsys=${i#/etc/rc$runlevel.d/S??}
        [ -f /var/lock/subsys/$subsys -o -f /var/lock/subsys/$subsys.init ] \
                && continue
If your script is called K01snowdog, then rc looks for /var/lock/subsys/snowdog or /var/lock/subsys/snowdog.init. If either of these files exist then "K01snowdog stop" is executed. If neither snowdog nor snowdog.init exist "K01snowdog stop" will not be called.

You need to change your script to create and destroy the correct file in /var/lock/subsys:

Code:
start)
touch /var/lock/subsys/snowdog
echo "Start" >> $logfile
;;
stop)
echo "Stop" >> $logfile
rm -f /var/lock/subsys/snowdog
;;
 
Old 11-11-2006, 08:09 AM   #3
dvkwiatk
LQ Newbie
 
Registered: May 2005
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks, Shortly after posting I reviewed some of the built-in scripts and discovered the /var/lock/subsys lines and added them to my scripts. Everything is working great.

Thanks,
Ed
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with permissions levels bison42 Linux - Newbie 7 02-22-2005 10:26 PM
how do I use the security levels bkhornet Mandriva 1 12-14-2004 04:40 AM
Access Levels Obie Linux - Security 1 08-28-2004 04:58 AM
The rc0.d and rc6.d files are located were?!? bripage Linux - General 6 07-24-2002 10:39 AM
User levels? Eternal LQ Suggestions & Feedback 2 04-17-2002 07:01 AM


All times are GMT -5. The time now is 10:30 AM.

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.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration