summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-power/nut/files/nut-2.6.5-init.d-upsd')
-rw-r--r--sys-power/nut/files/nut-2.6.5-init.d-upsd37
1 files changed, 37 insertions, 0 deletions
diff --git a/sys-power/nut/files/nut-2.6.5-init.d-upsd b/sys-power/nut/files/nut-2.6.5-init.d-upsd
new file mode 100644
index 00000000..c4debd30
--- /dev/null
+++ b/sys-power/nut/files/nut-2.6.5-init.d-upsd
@@ -0,0 +1,37 @@
+#!/sbin/openrc-run
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+extra_started_commands="reload"
+
+pidfile=/var/lib/nut/upsd.pid
+bin=/usr/sbin/upsd
+
+depend() {
+ use net
+ before upsmon
+ after upsdrv
+}
+
+start() {
+ ebegin "Starting upsd"
+ # clean up first
+ pkill -u root,nut -x ${bin}
+ sleep 1
+ rm -f ${pidfile}
+ # now start up
+ start-stop-daemon --start --quiet --exec ${bin}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping upsd"
+ start-stop-daemon --stop --quiet --pidfile ${pidfile}
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading upsd"
+ start-stop-daemon --stop --signal HUP --oknodo --quiet --pidfile ${pidfile}
+ eend $?
+}