Tzafrir Cohen wrote:
On Sun, Oct 12, 2008 at 09:56:00PM +0530, Bhasker C V wrote:
Hi,

 I was trying to find out if there are any shutdown hooks.
What i mean by this is that i must be able to have some conditions met before actual shutdown starts.

 Eg:- Suppose there is a very important process running, the hook must
      check this and if the hook returns non-zero, the system must
      refuse a requested shutdown.

I can write a wrapper to /sbin/shutdown for doing this, but i am just trying to find out if there is any method already available for doing this ?

aptitude install molly-guard

From the man page:

       molly-guard attempts to prevent you from accidentally shutting down or
       rebooting machines. It does this by injecting a couple of checks before
       the existing commands: halt, reboot, shutdown, and poweroff. This
       happens via scripts with the same names in /usr/sbin, so it only works
       if you have /usr/sbin before /sbin in your PATH!

       Before molly-guard invokes the real command, all scripts in
       /etc/molly-guard/run.d/ have to run and exit successfully; else, it
       aborts the command.  run-parts(1) is used to process the directory.

It is intended to prevent you from easily rebooting a remote server
(thinking it were your own). But I figure it can be easily adapted.


I learn something new every day.

Hugo


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to