#!/sbin/openrc-run
# Copyright 2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

description='Signal the UPS to kill power in a power failure condition'

depend() {
	need mount-ro
}

start() {
	if [ "$RC_RUNLEVEL" = "shutdown" -a -f /etc/apcupsd/powerfail ] ; then
		ebegin 'Signaling UPS to kill power'
		/sbin/apcupsd --killpower
		eend $?
	fi
}
