apcupsd and 'shutdown -p'

Rishi Chopra rchopra at cal.berkeley.edu
Sat Apr 24 12:38:09 PDT 2004


Rishi Chopra wrote:
> I'd like apcupsd to call 'shutdown -p' when halting the system. 
> Currently the daemon works OK but allows for a race condition (e.g. 
> battery is not dead but power is restored, leaving the system waiting 
> for a key to be pressed)...
> 
> Anyone have any ideas on how to accomplish this?
> 

Problem has been solved.  Command can be aliased through shell variable 
manipulation -or- as Neil Darlow suggested on the apcupsd mailing list 
([apcupsd-users] apcupsd and 'shutdown -p', 4/23/2004, 1:20AM):


Just change the shutdown command in the doshutdown case within 
apccontrol to the following:

     doshutdown)
         echo "UPS ${2} initiated Shutdown Sequence" | wall
         ${SHUTDOWN} -p now "apcupsd UPS ${2} initiated shutdown"
     ;;

Note: this will require APM or ACPI to be enabled in your BIOS and system
configuration (i.e. run apmd at startup for APM or enable ACPI in your
kernel). ACPI is still experimental, your mileage may vary.


NOTE: files referenced located in /usr/local/etc/apcupsd

-- 
Rishi Chopra
http://www.ocf.berkeley.edu/~rchopra


More information about the freebsd-questions mailing list