runlevels

C. Linus Hicks lhicks at nc.rr.com
Thu Jan 6 01:52:01 UTC 2005


On Wed, 2005-01-05 at 13:35 -0700, Schott, Erik J Mr ANOSC/FCBS wrote:
> But, are not the Kill scripts for a particular service run when the
> operating system leaves that run level on its way down to a lower run level,
> vice when one enters the next lower run level?  Example: if one starts a
> service in run level 3 and wishes to kill that service when entering run
> level 2, then one must put the kill script in the same rc?.d
> directory...otherwise, if you put the kill script at run level 2, then the
> operating system will not execute said kill script until it is in the
> process of exiting run level 2 on its way down to run level 1 or run level
> 0.
> 
> More simply put:  if I have a S??something script in /etc/rc3.d and I want
> to terminate that service if I leave run level 3, going down, then I must
> put my K??something script in /etc/rc3.d also.  If I put the K??something
> script in /etc/rc2.d, it will not execute until I exit run level 2, going
> down.

Init scripts don't get run exiting a level.

If you want a service up in level x, rc.x has an S??service.

If you want a service down in level y, rc.y has a K??service.

If you don't have either, it will depend on your previous runlevel.

An example:

[root at lh4 etc]# find /etc/rc.d -name "*sshd"
/etc/rc.d/rc4.d/S55sshd
/etc/rc.d/init.d/sshd
/etc/rc.d/rc0.d/K25sshd
/etc/rc.d/rc5.d/S55sshd
/etc/rc.d/rc1.d/K25sshd
/etc/rc.d/rc2.d/S55sshd
/etc/rc.d/rc6.d/K25sshd
/etc/rc.d/rc3.d/S55sshd

-- 
C. Linus Hicks <lhicks at nc dot rr dot com>




More information about the redhat-list mailing list