#!/bin/sh
# apcupsd halt script
# by Martin Mitchell <martin@debian.org>
# modifications by Gordon Morehouse <spambox@evernex.com> April 2001

case "$1" in
	poweroff | killpower)
	if [ -f /etc/apcupsd/powerfail ]; then
		echo ""
		echo -n "apcupsd: Ordering UPS to kill power... "
		/etc/apcupsd/apccontrol killpower
		echo "done."	
		echo ""
		echo "Please ensure the UPS has powered off before rebooting."
		echo "Otherwise, the UPS may cut the power during the reboot!"
		echo ""
		sleep 2d
	fi
	;;

	*)
	;;
esac

exit 0
