fork unRAID NUT plugin
This commit is contained in:
69
source/nut/etc/rc.d/rc.nut
Executable file
69
source/nut/etc/rc.d/rc.nut
Executable file
@ -0,0 +1,69 @@
|
||||
#!/bin/sh
|
||||
# Slackware startup script for Network UPS Tools
|
||||
# Copyright 2010 V'yacheslav Stetskevych
|
||||
# Edited for unRAID by macester macecapri@gmail.com
|
||||
|
||||
DPATH=/usr/bin
|
||||
FILE=/boot/config/plugins/nut/nut.cfg
|
||||
export PATH=$DPATH:$PATH
|
||||
|
||||
|
||||
|
||||
start_driver() {
|
||||
/usr/sbin/upsdrvctl -u root start || exit 1
|
||||
}
|
||||
|
||||
start_upsd() {
|
||||
/usr/sbin/upsd -u root || exit 1
|
||||
}
|
||||
|
||||
start_upsmon() {
|
||||
/usr/sbin/upsmon -u root || exit 1
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo "Stopping the UPS services... "
|
||||
if pgrep upsd 2>&1 >/dev/null; then
|
||||
/usr/sbin/upsd -c stop; fi
|
||||
if pgrep upsmon 2>&1 >/dev/null; then
|
||||
/usr/sbin/upsmon -c stop; fi
|
||||
/usr/sbin/upsdrvctl stop
|
||||
sleep 2
|
||||
if [ -f /var/run/upsmon.pid ]; then
|
||||
rm /var/run/upsmon.pid; fi
|
||||
}
|
||||
|
||||
write_config() {
|
||||
/usr/local/emhttp/plugins/nut/scripts/write_config.sh
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start) # starts everything (for a ups server box)
|
||||
sleep 1
|
||||
write_config
|
||||
sleep 3
|
||||
start_driver
|
||||
start_upsd
|
||||
start_upsmon
|
||||
;;
|
||||
start_upsmon) # starts upsmon only (for a ups client box)
|
||||
start_upsmon
|
||||
;;
|
||||
stop) # stops all UPS-related daemons
|
||||
stop
|
||||
;;
|
||||
shutdown) # shuts down the UPS
|
||||
echo "Killing inverter..."
|
||||
/usr/sbin/upsdrvctl shutdown
|
||||
;;
|
||||
reload)
|
||||
write_config
|
||||
/usr/sbin/upsd -c reload
|
||||
/usr/sbin/upsmon -c reload
|
||||
;;
|
||||
write_config)
|
||||
write_config
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|start_upsmon|stop|shutdown|reload|restart|write_config}"
|
||||
esac
|
1
source/nut/etc/ups/nut.conf
Executable file
1
source/nut/etc/ups/nut.conf
Executable file
@ -0,0 +1 @@
|
||||
MODE=standalone
|
3
source/nut/etc/ups/ups.conf
Executable file
3
source/nut/etc/ups/ups.conf
Executable file
@ -0,0 +1,3 @@
|
||||
[ups]
|
||||
driver=none
|
||||
port=auto
|
1
source/nut/etc/ups/upsd.conf
Executable file
1
source/nut/etc/ups/upsd.conf
Executable file
@ -0,0 +1 @@
|
||||
LISTEN 0.0.0.0
|
11
source/nut/etc/ups/upsd.users
Executable file
11
source/nut/etc/ups/upsd.users
Executable file
@ -0,0 +1,11 @@
|
||||
[admin]
|
||||
password=adminpass
|
||||
actions=set
|
||||
actions=fsd
|
||||
instcmds=all
|
||||
[monuser]
|
||||
password=monpass
|
||||
upsmon master
|
||||
[slaveuser]
|
||||
password=slavepass
|
||||
upsmon slave
|
6
source/nut/etc/ups/upsmon.conf
Executable file
6
source/nut/etc/ups/upsmon.conf
Executable file
@ -0,0 +1,6 @@
|
||||
MONITOR ups@localhost 1 monuser monpass master
|
||||
SHUTDOWNCMD "/usr/local/sbin/powerdown"
|
||||
POWERDOWNFLAG /etc/ups/flag/killpower
|
||||
NOTIFYFLAG ONBATT SYSLOG+EXEC
|
||||
NOTIFYFLAG ONLINE SYSLOG+EXEC
|
||||
NOTIFYCMD "/etc/ups/notifycmd"
|
1
source/nut/etc/ups/upssched.conf
Executable file
1
source/nut/etc/ups/upssched.conf
Executable file
@ -0,0 +1 @@
|
||||
|
Reference in New Issue
Block a user