mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-04-19 19:36:44 +02:00
When the system is shut down, /etc/nologin is created. However, it is not removed when the system starts back up. This results in users being unable to log in after a power outage.
39 lines
875 B
Bash
39 lines
875 B
Bash
#!/sbin/openrc-run
|
|
# Copyright 2007 Gentoo Foundation
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
# $Header: /var/cvsroot/gentoo-x86/sys-power/apcupsd/files/apcupsd.init.2,v 1.1 2009/01/15 15:21:11 flameeyes Exp $
|
|
|
|
INSTANCE="${SVCNAME#*.}"
|
|
if [ -z "${INSTANCE}" ] || [ "${SVCNAME}" = "apcupsd" ]; then
|
|
INSTANCE="apcupsd"
|
|
fi
|
|
|
|
depend() {
|
|
use net
|
|
after firewall
|
|
}
|
|
|
|
start() {
|
|
rm -f /etc/apcupsd/powerfail
|
|
rm -f /etc/nologin
|
|
|
|
export SERVICE="${SVCNAME}"
|
|
|
|
ebegin "Starting APC UPS daemon"
|
|
start-stop-daemon \
|
|
--start --pidfile "/var/run/${SVCNAME}.pid" \
|
|
--exec /sbin/apcupsd -- \
|
|
-f "/etc/apcupsd/${INSTANCE}.conf" \
|
|
-P "/var/run/${SVCNAME}.pid"
|
|
eend $?
|
|
}
|
|
|
|
stop() {
|
|
ebegin "Stopping APC UPS daemon"
|
|
start-stop-daemon \
|
|
--stop --pidfile "/var/run/${SVCNAME}.pid" \
|
|
--retry TERM/5/TERM/5 \
|
|
--exec /sbin/apcupsd
|
|
eend $?
|
|
}
|
|
|