summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@gentoo.org>2009-03-22 13:58:12 +0000
committerDiego Elio Pettenò <flameeyes@gentoo.org>2009-03-22 13:58:12 +0000
commitcc1a325b284a13826f0e44f569cf11c17e266ba5 (patch)
treec8a6ea1a497ce31cacb109008060a02da0567137 /sys-power/apcupsd/files
parent* bump (diff)
downloadgentoo-2-cc1a325b284a13826f0e44f569cf11c17e266ba5.tar.gz
gentoo-2-cc1a325b284a13826f0e44f569cf11c17e266ba5.tar.bz2
gentoo-2-cc1a325b284a13826f0e44f569cf11c17e266ba5.zip
Add init script for shutting the UPS down on power failure. Thanks to Matt Whitlock in bug #262234.
(Portage version: 2.2_rc26/cvs/Linux x86_64)
Diffstat (limited to 'sys-power/apcupsd/files')
-rw-r--r--sys-power/apcupsd/files/apcupsd.powerfail.init18
1 files changed, 18 insertions, 0 deletions
diff --git a/sys-power/apcupsd/files/apcupsd.powerfail.init b/sys-power/apcupsd/files/apcupsd.powerfail.init
new file mode 100644
index 000000000000..35ee364c80ca
--- /dev/null
+++ b/sys-power/apcupsd/files/apcupsd.powerfail.init
@@ -0,0 +1,18 @@
+#!/sbin/runscript
+# Copyright 2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-power/apcupsd/files/apcupsd.powerfail.init,v 1.1 2009/03/22 13:58:11 flameeyes Exp $
+
+description='Signal the UPS to kill power in a power failure condition'
+
+depend() {
+ need mount-ro
+}
+
+start() {
+ if [[ $(runlevel) == *' 0' && -f /etc/apcupsd/powerfail ]] ; then
+ ebegin 'Signaling UPS to kill power'
+ /sbin/apcupsd --killpower
+ eend $?
+ fi
+}