APCUPSD

From VVCWiki
Revision as of 21:10, 21 November 2009 by Vvc (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Automatic server recovery with APCUPSD

  • Setup BIOS to recover "LAST" power state
  • Make OS to halt on power loss
/etc/apcupsd/doshutdown
#!/bin/sh

/sbin/shutdown -h -H now "apcupsd UPS ${1} initiated shutdown"

exit 99
  • If UPS supports it, power-off UPS, so if power returns before battery is completely exhausted, UPS and the server will get restarted.
/sbin/halt.local
#!/bin/sh

# See if this is a powerfail situation.
if [ -f /etc/apcupsd/powerfail ]; then
echo
echo "APCUPSD will now power off the UPS"
echo
/etc/apcupsd/apccontrol killpower
fi