[kwlug disc.] One question.
Paul Nijjar
pnijjar at sdf.lonestar.org
Sun Jun 3 19:12:51 EDT 2007
On Sat, 2 Jun 2007 john at netdirect.ca wrote:
> It depends on the distrop I think. On redhat, Fedora, CentOS and other
> distros that use initscripts you would create an /etc/init.d/ script and
> link it to the /etc/rc.d/rc0.d directory for shutdown and the rc6.d for
> reboot.
The way you name the scripts is important. In /etc/init.d you
would make the script (use the others as templates -- they are supposed to
take "start", "stop", "reload" and other options). Then you make the
symlink in the rc0.d/ and rc6.d/ directories carefully -- the name of the
symlink determines the order in which scripts are executed. You will nee
to take this into account when re-powering up your system, I think.
There is a good description of this in the Debian Policy Manual
(but I think it applies to other distros). Here is an excerpt from section
9.3 of the manual (available as package "debian-policy" on Debian):
====
The names of the links all have the form Smmscript or Kmmscript where mm
is a two-digit number and script is the name of the script (this should be
the same as the name of the actual script in /etc/init.d).
When init changes runlevel first the targets of the links whose names
start with a K are executed, each with the single argument stop, followed
by the scripts prefixed with an S, each with the single argument start.
(The links are those in the /etc/rcn.d directory corresponding to the new
runlevel.) The K links are responsible for killing services and the S link
for starting services upon entering the runlevel.
For example, if we are changing from runlevel 2 to runlevel 3, init will
first execute all of the K prefixed scripts it finds in /etc/rc3.d, and
then all of the S prefixed scripts in that directory. The links starting
with K will cause the referred-to file to be executed with an argument of
stop, and the S links with an argument of start.
The two-digit number mm is used to determine the order in which to run the
scripts: low-numbered links have their scripts run first. For example, the
K20 scripts will be executed before the K30 scripts. This is used when a
certain service must be started before another.
====
Hopefully that gives you enough information so you won't have to wrestle
the "tourists" (we're supposed to believe there are tourists in
Whitehorse?) for internet time.
- Paul
--
Paul Nijjar - http://www.fairvotecanada.org/WaterlooRegion
Next electoral reform info night: Tuesday June 12, 7pm
More information about the KWLUG-Disc
mailing list