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

Re: Init not behaving the way man says it does?



On Fri, Jun 15, 2001 at 09:23:06AM -0500, Andrew Dixon wrote:
> Craig McLean wrote:
> > 
> > The man page states that whenever you transition between two run levels, it
> > sends all processes not in the new run level the SIGTERM and then SIGKILL
> > signals.  Also in the debian case it runs the rc script which does all the K
> > entries and all the S entries, in the new runlevels    rc[0-6sS].d
> > directory. When I transition from run level [2345] to run level [016sS] this
> > is exactly what happens.  However when I try to transition from any of the
> > user defined run levels to any of the other user defined run levels (going
> > from [2345] to [2345]) it doesn't do what it is supposed to do.  
> 
> check out the /etc/rc script.  It's what actually runs all of the
> scripts in the rc[0-6sS].d directories.  I think it's smart enough to
> only start services that are not in the previous run level instead of
> killing and restarting everything.  So if you switch from level 2 to 3
> only those S scripts is /etc/rc3.d that are not in /etc/rc2.d will be
> run.

use the source, luke:

	pager /etc/init.d/rc

when entering runlevel Q, it first runs all relevant K* scripts
thus:

	for daemon in /etc/rc$RUNLEVEL.d/K[0-9][0-9]*
	do
		$daemon stop
	done

(basically).  after killing all the K* script daemons, it starts
the S* scripts like so:

	for daemon in /etc/rc$RUNLEVEL.d/S[0-9][0-9]*
	do
		$daemon start
	done

(for the most part). it doesn't seem to care a whit whether
you've got K01postgres and S01postgres in the same runlevel, nor
does it appear to check whether you've been running S77exim
before shutting it down with K38exim. it just runs all K* with
arg 'stop', then all S* with arg 'start'.

unless i'm mistaken.

-- 
DEBIAN NEWBIE TIP #46 from Will Trillich <will@serensoft.com> 
:
Troubled by MAC-FORMAT TEXT FILES? There are many ways
to translate CR to LF. VIM can help, with these steps:
	:set ffs=mac
	:e!
	:set ff=unix
and then save/write the file (":opt" for more info).
In perl, this'll do the trick:
	perl -pi.mac -l12 -015 -e ';' filename*pattern.txt
(that's a <hyphen-el-one-two> and <hyphen-zero-one-five>, by
the way -- see "perldoc perlrun" for more info.)

Also see http://newbieDoc.sourceForge.net/ ...



Reply to: