The NZ Linux Resource

[AuckLUG] How do I run app at shutdown

thomas ockens to at ciphirelabs.com
Sun Sep 24 10:15:08 NZST 2006


Hello,

Banjo Donila wrote:
> you can use /etc/init.d/rc0.d/ or rc6.d
> create a script there
> 
> hmm... this might be debian, I hope you get the point.

I *think* Fedora and Debian both use SystemV-like init scripts, so your
example should work for Ron.

Ron, in /etc/init.d/rcX.d (where X stands for a certain runlevel) there
should be two kinds of scripts - those starting with an S, and those
starting with a K.  The S-scripts are being run at startup time, and the
K-scripts are being run at shutdown time, basically[1].
You'll notice the scripts are numbered - that number determines the
sequence in which they're run, from lowest to highest.  For example,
your network ought to start up before samba or other daemons depending
on the network are being started, so the network initscript will have a
lower S-number than samba.

With all that out of the way: you'll want to determine what commands
your script will be running, and if it needs a certain other service to
still be active at runtime - if it does, you'll want to give your script
a number that's slightly lower than the K-script of the service you
still need.

If your script has no requirements, K99local should be a safe spot to
drop your code.

Kind regards,


thomas
------
[1]OK OK - not *entirely* correct, but you get the point :)



More information about the AuckLUG mailing list If you have any questions or comments about this page, email the Webmaster
Design Copyright © 1998-2005 Linux.net.nz