[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: init.d scripts runs at rc5.d, not rc0.d



On Tue, 2004-04-06 at 08:13, Brian Millett wrote:
> Hi, I have the latest rawhide updates (except for --exclude=Canna*
> --exclude=kinput2-canna-wnn6 --exclude=nvi-m17n-canna).  I have a script
> to start Jetty.
> 
> chkconfig jettyctl --list
> jettyctl        0:off   1:off   2:on    3:on    4:on    5:on    6:off
> 
> The problem is that when I start up, the script runs just fine for
> runlevel 5.  When I shutdown, or reboot, then the script does not run
> for the 0, or 6 runlevel.  
> 
> So, what causes a script to run for level 0 or 6?  Just having a
> K20jettyctl does not seem to do the trick.  I noticed that I have many
> scripts in rc0.d that do not run, or at least i can not get them to run
> at shutdown.  Can someone enlighten me as to what causes a stop to run
> on shutdown?

Thanks to Fred for the hint in the right direction.  The problem it
seems is an undocumented feature of the /etc/rc.d/rc script.  Let me
explain.  In the rc script, there is 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

So as you can see, the "stop" action is called ONLY if 
1) the K* script exists AND
2) there is a lock file in the /var/locl/subsys that is the name of the
script being ran.

I, in my ignorance, had a lock file called "jetty", not "jettyctl"

Question to the sages:
Why?  If the lock file is so important to the success or failure of the
execution of the script, then why not have the rc script write the lock
file? 

Thanks.
-- 
Brian Millett  -  Technologist Rex 
'But you killed ten thousand Narns.' 
"I didn't know you cared. Ten thousand, a hundred thousand, a million, 
    what's the difference? They're Narns, Ambassador. Your sworn enemy."
   -- Londo and Morden, "Chrysalis"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]