summaryrefslogtreecommitdiffstats
path: root/source/a/nut/rc.nut-upsmon
diff options
context:
space:
mode:
Diffstat (limited to 'source/a/nut/rc.nut-upsmon')
-rw-r--r--source/a/nut/rc.nut-upsmon46
1 files changed, 46 insertions, 0 deletions
diff --git a/source/a/nut/rc.nut-upsmon b/source/a/nut/rc.nut-upsmon
new file mode 100644
index 000000000..8fc5ec8f8
--- /dev/null
+++ b/source/a/nut/rc.nut-upsmon
@@ -0,0 +1,46 @@
+#!/bin/sh
+# NUT upsmon start-up and shutdown script.
+# upsmon is the client process that is responsible for the most important part
+# of UPS monitoring--shutting down the system when the power goes out.
+#
+# upsmon should be run on every machine that is powered by the UPS if you wish
+# to support automatic shutdown on battery power.
+#
+# See /etc/nut/ for configuration files.
+
+# Start upsmon:
+upsmon_start() {
+ # Make sure the runtime directory is there:
+ mkdir -p /run/nut
+ chown -R nut:nut /run/nut
+ chmod 0770 /run/nut
+ # Start the NUT UPS monitor and shutdown controller:
+ echo "Starting the NUT UPS monitor and shutdown controller: upsmon -u nut"
+ upsmon -u nut
+}
+
+# Stop upsmon:
+upsmon_stop() {
+ echo "Stopping the NUT UPS monitor and shutdown controller."
+ upsmon -c stop
+}
+
+# Reload configuration files for upsmon:
+upsmon_reload() {
+ echo "Reloading configuration files for the NUT UPS monitor and shutdown controller: upsmon -c reload"
+ upsmon -c reload
+}
+
+case "$1" in
+'start')
+ upsmon_start
+ ;;
+'stop')
+ upsmon_stop
+ ;;
+'reload')
+ upsmon_reload
+ ;;
+*)
+ echo "usage $0 start|stop|reload"
+esac