Re: shutdown via /etc/rc.d/rcN.d/KNN* files

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

 



On Wed, 2007-03-28 at 20:01 -0700, Wolfgang S. Rupprecht wrote:
> Can someone please explain the order of the /etc/rc.d/rcN.d/KNN* files
> execution during shutdown?  First which directory is used for the
> files rc0.d?
> 
> I have a few homegrown files that are are all symlinked as
> K01<somethingorother> eg. they all start with "K01" and should be
> executed first.  I only see a single one of the files executed, most
> are skipped.  Does each file need a unique Knn number or is sharing a
> number legal?
> 
> The files run fine is I do a "service foo start" or "service foo
> stop".  It is just the automatic shutdown that seems to skip them.
> 

Hi Wolfgang,

I'll give it a shot trying to explain - hopefully I'll make sense for
you.

The scripts themselves reside in /etc/rc.d/init.d/....

Based on a comment line in the script itself, the script can be managed
via chkconfig to create/remove the symbolic links
in /etc/rc.d/rc[0-6].d/....  That comment line is of the form:
# chkconfig: runlevels SS KK
where runlevels are the default "on" runlevels when we use chkconfig
--add, and SS is the two digits for the "S"tart symbolic link, and KK is
the two digits for the "K"ill symbolic link.

Now when you "change" runlevel, we do not care about what runlevel you
are coming from, just the runlevel you are going to.  Remember halting
the system is going to runlevel 0 and rebooting the system is going to
runlevel 6.  The /etc/rc.d/rc script is going to run scripts from the
destination runlevel directory /etc/rc.d/rc#.d/ and, in fact,
"selectively" runs the K scripts for any service that is "CURRENTLY
RUNNING", followed by running the S scripts for any service that is "NOT
CURRENTLY RUNNING"....  Where many people make a mistake is how we
determine whether a service is "currently running" or not....  It is
"assumed" that the script will create/remove a "lock file"
in /var/lock/subsys/ that identifies that the service is running by the
"lock file" existing.  Look at an existing script for an example....

I am guessing that you are thinking that we use these rc#.d directories
like some other "distributions", or that your script is failing to
create the "lock file" and hence the K script is not running....

I hope that helps....

--Rob


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux