Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Oct 2001 15:37:31 -0400
From:      Bob Johnson <bob@eng.ufl.edu>
To:        questions@freebsd.org
Subject:   How to auto-execute script AFTER shutdown?
Message-ID:  <3BCF2F7B.A5B40B2D@eng.ufl.edu>

next in thread | raw e-mail | index | archive | help

I've installed NUT with the genericups driver to monitor my APC Back-UPS.  
In order to cleanly power down the system, I need to be able to do the 
following:

- when time comes to power down the system, shut down to single 
  user mode so (as much as possible) all processes are cleanly 
  terminated and various buffers are flushed.

- after shutdown is complete and the system is in single user mode, 
  issue a shutdown command to the UPS so it turns off power.

- finally, pause a while then issue a reboot command.  This is so that 
  if power returns just as the UPS is shutting down, thus aborting the 
  shutdown, the system will return to normal operation.  If the UPS 
  succeeds in shutting down, the reboot command will never be issued.

I can't find any hooks that will let me execute a script after shutting 
down to single user mode.  rc.shutdown appears to execute just _before_ 
shutdown, to allow custom cleanup.  Is there some way to accomplish 
this?  It would be neat if there were a specific file name that gets 
executed in single user mode when you shut down from multi-user mode.


- Bob

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3BCF2F7B.A5B40B2D>