Re: Run command on shutdown
On Wed, Jul 12, 2006 at 10:28:15AM -0500, Ron Johnson wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Michael Ott wrote:
> > Hello Marco!
> >
> >> What's the safest way to run a command on every shutdown?
> > Create an init script and create a link into rc0.d
>
> rc0.d or rc6.d?
If you look at the contents of /etc/rc6.d and /etc/rc0.d, by default
they are identical except for the reboot and halt scripts:
digbyt@fujitsu:/etc/X11$ cd /etc/rc0.d
digbyt@fujitsu:/etc/rc0.d$ ls -l >/tmp/0
digbyt@fujitsu:/etc/rc0.d$ cd ../rc6.d
digbyt@fujitsu:/etc/rc6.d$ ls -l >/tmp/6
digbyt@fujitsu:/etc/rc6.d$ diff /tmp/6 /tmp/0
49c49
< -rw-r--r-- 1 root root 353 2006-03-27 14:42 README
---
> -rw-r--r-- 1 root root 355 2006-03-27 14:42 README
58c58
< lrwxrwxrwx 1 root root 16 2006-04-26 07:50 S90reboot -> ../init.d/reboot
---
> lrwxrwxrwx 1 root root 14 2006-04-26 07:50 S90halt -> ../init.d/halt
So if you really only want to run your script on shutdown and not
on reboot, then put it in rc0.d only. If you want it run on
shutdown or reboot, then put it in both...
Regars,
DigbyT
--
Digby R. S. Tarvin digbyt(at)digbyt.com
http://www.digbyt.com
Reply to: