|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
hi,
i wanna to how to make program to run automatically when is about to shutdown or reboot |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On 2008-03-25, bharath venk <bharathv6.project@gmail.com> wrote:
> > > hi, > i wanna to how to make program to run automatically when is > about to shutdown or reboot Put the script in /etc/init.d and place symbolic links in the /etc/rc?.d directories. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
bharath venk wrote:
> hi, > i wanna to how to make program to run automatically when is > about to shutdown or reboot This depends on your OS. For Fedora which uses a standard Sys V init system, create your script in /etc/init.d. Then make symlinks to that script in /etc/rc0.d and /etc/rc6.d. (On Fedora these directories are symlinks; the real pathnames are /etc/rc.d/*.) Be sure to name the symlink so it runs last, but before the disks are unmounted, etc. I recommend the following names: /etc/init.d/shutdownhook /etc/rc[06].d/K99zz-shutdownhook IIRC this won't work for SuSE. While that use a Sys V init I seem to remember they cleverly wrote their "rc" program to compare services running in the current the services that should be running in the new runlevel, then turned off the ones that should be off (in reverse order of startup) and then turned on any that should be on. Thus SuSE only uses the S##scripts and ignores any K##scripts. (I haven't checked this in years, it might be different now.) Now if you use Solaris or some other distros/flavors, you may not use Sys V init system at all. You should check your system's documentation for an answer, or post your question in a more appropriate forum. -Wayne |
|
![]() |
| Outils de la discussion | |
|
|