aboutsummaryrefslogtreecommitdiffstats
path: root/community/nut/upsmon.initd
diff options
context:
space:
mode:
Diffstat (limited to 'community/nut/upsmon.initd')
-rw-r--r--community/nut/upsmon.initd35
1 files changed, 35 insertions, 0 deletions
diff --git a/community/nut/upsmon.initd b/community/nut/upsmon.initd
new file mode 100644
index 00000000000..4a7efe8ba44
--- /dev/null
+++ b/community/nut/upsmon.initd
@@ -0,0 +1,35 @@
+#!/sbin/openrc-run
+
+name="UPS Monitor"
+pidfile=/run/upsmon.pid
+command=/usr/sbin/upsmon
+required_files="/etc/nut/nut.conf /etc/nut/upsmon.conf"
+extra_started_commands="reload"
+start_stop_daemon_args="--quiet"
+
+depend() {
+ . /etc/nut/nut.conf
+ case $MODE in
+ standalone|netserver)
+ need nut-upsd
+ ;;
+ esac
+ use net dns
+}
+
+start_pre() {
+ . /etc/nut/nut.conf
+ case $MODE in
+ none)
+ eerror "$name disabled, please adjust the configuration to your needs"
+ eerror "Then set MODE to a suitable value in /etc/nut/nut.conf to enable it"
+ return 1
+ ;;
+ esac
+}
+
+reload() {
+ ebegin "Reloading $name"
+ start-stop-daemon --signal HUP --pidfile $pidfile
+ eend $?
+}