Afficher un message
Vieux 26/03/2008, 04h00   #3
Wayne
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: execute a program during a system shutdown or reboot

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
  Réponse avec citation
 
Page generated in 0,05404 seconds with 9 queries