blob: ebd6b9755d4f00af3fead5be6bfbac4cb0505f44 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#!/sbin/openrc-run
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
INSTANCE="${SVCNAME#*.}"
if [ -z "${INSTANCE}" ] || [ "${SVCNAME}" = "apcupsd" ]; then
INSTANCE="apcupsd"
fi
dir="/run/apcupsd"
depend() {
use net
}
start_pre() {
checkpath -d -m 0775 -o root:uucp ${dir}
}
start() {
rm -f /etc/apcupsd/powerfail
export SERVICE="${SVCNAME}"
if [ ! -d "${dir}" ]; then
einfo " Creating ${dir}"
/bin/mkdir -p "${dir}"
/bin/chown root:uucp "${dir}"
fi
ebegin "Starting APC UPS daemon"
start-stop-daemon \
--start --pidfile "${dir}/${SVCNAME}.pid" \
--exec /sbin/apcupsd -- \
-f "/etc/apcupsd/${INSTANCE}.conf" \
-P "${dir}/${SVCNAME}.pid"
eend $?
}
stop() {
ebegin "Stopping APC UPS daemon"
start-stop-daemon \
--stop --pidfile "${dir}/${SVCNAME}.pid" \
--retry TERM/5/TERM/5 \
--exec /sbin/apcupsd
eend $?
}
|