aports/main/apcupsd/apcupsd.powerfail.initd
Alex Sivchev 2a13b74e19 main/apcupsd: add script to execute killpower on shutdown
Executing killpower is needed to ensure that the system will automatically
reboot when the mains power is restored [1].

The script was taken from Gentoo [2].

[1] http://www.apcupsd.org/manual/manual.html#shutdown-sequence
[2] https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-power/apcupsd/files/apcupsd.powerfail.init
2021-08-31 15:26:27 +00:00

17 lines
389 B
Bash

#!/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
}