I've got a few commands that I run in rc.local so they are run last in the startup sequence. I would like to know if there is a similar facility for undoing the results of those commands at shutdown, like an rc.shutdown. Ideally, it would be run before any of the other /etc/init.d scripts.
|
|
|||||
|
|
Not really (at least, to my knowledge). If you've got SystemV style init scripts, you could create something along the lines of |
||||
|
|
|
If you have upstart, you can catch the shutdown event and run a script when it is caught. |
|||
|
|
|
ArchLinux does have a |
||||
|
|
|
In Gentoo the "local" script does exactly what you ask for: It runs certain user specified commands upon 'start' and another set of commands upon 'stop'. |
|||
|
|
|
It is generally possible, but depends on the init-scripts system you have. If your distribution used a recent version of OpenRC (as Gentoo does), you could put any scripts in The order depends on the rc-system settings, but typically the local scripts are the last to run at startup and first to run at shutdown. |
||||
|
|
protected by Michael Mrozek♦ Mar 8 '11 at 4:04
This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have earned at least 10 reputation on this site.
