summaryrefslogtreecommitdiffstats
path: root/source/a/nut/rc.nut-drvctl
diff options
context:
space:
mode:
Diffstat (limited to 'source/a/nut/rc.nut-drvctl')
-rw-r--r--source/a/nut/rc.nut-drvctl32
1 files changed, 32 insertions, 0 deletions
diff --git a/source/a/nut/rc.nut-drvctl b/source/a/nut/rc.nut-drvctl
new file mode 100644
index 000000000..c310d26c8
--- /dev/null
+++ b/source/a/nut/rc.nut-drvctl
@@ -0,0 +1,32 @@
+#!/bin/sh
+# NUT ups model-specific drivers start-up and shutdown script.
+# This should be started before rc.nut-upsd on the machine connected to the
+# UPS's control port. See /etc/nut/ for configuration files.
+
+# Start upsdrvctl:
+upsdrvctl_start() {
+ # Make sure the runtime directory is there:
+ mkdir -p /run/nut
+ chown -R nut:nut /run/nut
+ chmod 0770 /run/nut
+ # Load NUT driver(s):
+ echo "Starting the NUT UPS driver controller: upsdrvctl -u nut start"
+ upsdrvctl -u nut start
+}
+
+# Stop upsdrvctl:
+upsdrvctl_stop() {
+ echo "Stopping the NUT UPS driver controller."
+ upsdrvctl stop
+}
+
+case "$1" in
+'start')
+ upsdrvctl_start
+ ;;
+'stop')
+ upsdrvctl_stop
+ ;;
+*)
+ echo "usage $0 start|stop"
+esac