summaryrefslogtreecommitdiffstats
path: root/source/a/nut/rc.nut-upsd
diff options
context:
space:
mode:
Diffstat (limited to 'source/a/nut/rc.nut-upsd')
-rw-r--r--source/a/nut/rc.nut-upsd41
1 files changed, 41 insertions, 0 deletions
diff --git a/source/a/nut/rc.nut-upsd b/source/a/nut/rc.nut-upsd
new file mode 100644
index 000000000..3ca7cdc0b
--- /dev/null
+++ b/source/a/nut/rc.nut-upsd
@@ -0,0 +1,41 @@
+#!/bin/sh
+# NUT upsd start-up and shutdown script.
+# This should be started after rc.nut-drvctl on the machine connected to the
+# UPS's control port. See /etc/nut/ for configuration files.
+
+# Start upsd:
+upsd_start() {
+ # Make sure the runtime directory is there:
+ mkdir -p /run/nut
+ chown -R nut:nut /run/nut
+ chmod 0770 /run/nut
+ # Start the UPS daemon:
+ echo "Starting the NUT UPS information server: upsd -u nut"
+ upsd -u nut
+}
+
+# Stop upsd:
+upsd_stop() {
+ echo "Stopping the NUT UPS information server."
+ upsd -c stop
+}
+
+# Reload configuration files for upsd:
+upsd_reload() {
+ echo "Reloading configuration files for the NUT UPS information server: upsd -c reload"
+ upsd -c reload
+}
+
+case "$1" in
+'start')
+ upsd_start
+ ;;
+'stop')
+ upsd_stop
+ ;;
+'reload')
+ upsd_reload
+ ;;
+*)
+ echo "usage $0 start|stop|reload"
+esac