From 68210a716a4dfd9df9e5176c6ae9247fbdabdd57 Mon Sep 17 00:00:00 2001 From: dmacias72 Date: Sun, 21 May 2017 14:28:28 -0600 Subject: [PATCH] move nut plugin to separate repo --- source/nut/etc/rc.d/rc.nut | 69 -------- source/nut/etc/ups/ups.conf | 3 - source/nut/etc/ups/upsd.conf | 1 - source/nut/etc/ups/upsd.users | 11 -- source/nut/etc/ups/upsmon.conf | 6 - source/nut/etc/ups/upssched.conf | 1 - .../local/emhttp/plugins/nut/NUTsettings.page | 160 ------------------ .../usr/local/emhttp/plugins/nut/README.md | 3 - .../emhttp/plugins/nut/icons/nutdetails.png | Bin 952 -> 0 bytes .../emhttp/plugins/nut/icons/nutsettings.png | Bin 421 -> 0 bytes .../emhttp/plugins/nut/include/update.nut.php | 32 ---- .../local/emhttp/plugins/nut/scripts/rc.nut | 69 -------- .../emhttp/plugins/nut/scripts/txt/udev.txt | 4 - .../plugins/nut/scripts/write_config.sh | 99 ----------- 14 files changed, 458 deletions(-) delete mode 100755 source/nut/etc/rc.d/rc.nut delete mode 100755 source/nut/etc/ups/ups.conf delete mode 100755 source/nut/etc/ups/upsd.conf delete mode 100755 source/nut/etc/ups/upsd.users delete mode 100755 source/nut/etc/ups/upsmon.conf delete mode 100755 source/nut/etc/ups/upssched.conf delete mode 100755 source/nut/usr/local/emhttp/plugins/nut/NUTsettings.page delete mode 100755 source/nut/usr/local/emhttp/plugins/nut/README.md delete mode 100644 source/nut/usr/local/emhttp/plugins/nut/icons/nutdetails.png delete mode 100755 source/nut/usr/local/emhttp/plugins/nut/icons/nutsettings.png delete mode 100755 source/nut/usr/local/emhttp/plugins/nut/include/update.nut.php delete mode 100755 source/nut/usr/local/emhttp/plugins/nut/scripts/rc.nut delete mode 100755 source/nut/usr/local/emhttp/plugins/nut/scripts/txt/udev.txt delete mode 100755 source/nut/usr/local/emhttp/plugins/nut/scripts/write_config.sh diff --git a/source/nut/etc/rc.d/rc.nut b/source/nut/etc/rc.d/rc.nut deleted file mode 100755 index 92323dc5..00000000 --- a/source/nut/etc/rc.d/rc.nut +++ /dev/null @@ -1,69 +0,0 @@ -#!/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 diff --git a/source/nut/etc/ups/ups.conf b/source/nut/etc/ups/ups.conf deleted file mode 100755 index c2d29b0e..00000000 --- a/source/nut/etc/ups/ups.conf +++ /dev/null @@ -1,3 +0,0 @@ -[ups] -driver=none -port=auto diff --git a/source/nut/etc/ups/upsd.conf b/source/nut/etc/ups/upsd.conf deleted file mode 100755 index a32659e5..00000000 --- a/source/nut/etc/ups/upsd.conf +++ /dev/null @@ -1 +0,0 @@ -LISTEN 0.0.0.0 diff --git a/source/nut/etc/ups/upsd.users b/source/nut/etc/ups/upsd.users deleted file mode 100755 index 80c04e82..00000000 --- a/source/nut/etc/ups/upsd.users +++ /dev/null @@ -1,11 +0,0 @@ -[admin] -password=adminpass -actions=set -actions=fsd -instcmds=all -[monuser] -password=monpass -upsmon master -[slaveuser] -password=slavepass -upsmon slave diff --git a/source/nut/etc/ups/upsmon.conf b/source/nut/etc/ups/upsmon.conf deleted file mode 100755 index 8991b938..00000000 --- a/source/nut/etc/ups/upsmon.conf +++ /dev/null @@ -1,6 +0,0 @@ -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" diff --git a/source/nut/etc/ups/upssched.conf b/source/nut/etc/ups/upssched.conf deleted file mode 100755 index 8b137891..00000000 --- a/source/nut/etc/ups/upssched.conf +++ /dev/null @@ -1 +0,0 @@ - diff --git a/source/nut/usr/local/emhttp/plugins/nut/NUTsettings.page b/source/nut/usr/local/emhttp/plugins/nut/NUTsettings.page deleted file mode 100755 index 7353965e..00000000 --- a/source/nut/usr/local/emhttp/plugins/nut/NUTsettings.page +++ /dev/null @@ -1,160 +0,0 @@ -Menu="OtherSettings" -Type="xmenu" -Title="NUT Settings" -Icon="nut.png" ---- - - -style="display:none"> - - -
UPS StatusBattery Charge %Runtime Left Nominal PowerUPS LoadUPS Load %
 
- -
- - - Online Manual - -Start NUT UPS service: -: - -> Set to 'Yes' to enable NUT and start the service, set to 'No' to disable NUT and stop the service. -> Setting 'Yes' will also enable NUT on unRAID boot. - -UPS Driver: -: - -> **Check the link below to find the driver matching your UPS** -> -> + http://www.networkupstools.org/stable-hcl.html -> -> For other devices set **Custom** and enter the driver manually below. -> Dont forget to match the port with your driver -> Use the *Link* above to find which Driver to choose. -> Dont forget to match the port with your driver - - -UPS Port: -: - -> Enter the *port* which your UPS connects to. -> -> + **auto** - Set to "auto" if the ups is connected by usb. -> + **/dev/tty0** - Example, for seriall devices** - - -UPS Mode: -: - -> Select the *mode* which mode your UPS will run in. -> -> + **standalone** - When the ups is only used by the local host** -> + **netserver** - When nut clients/slaves need to connect to the ups** - - -UPS Shutdown Mode: -: - -> Select the *Shutdown mode* for NUT, this mode determines which "timer" to use for when the UPS will shutdown the system. -> -> + **Battery Level** - Shuts down the system when there is X percentage left on the battery ** -> + **Runtime Left** - Shuts down the system when there is X runtime left on the battery (in seconds)** -> + **Time on Battery** - Shuts down the system when the user defined timer reaches zero (in seconds)** - - -Battery level to initiate shutdown (%): -: - -> If during a power failure, the remaining battery percentage (as reported by the UPS) is below or equal to *Battery level*, NUT will initiate a system shutdown. - - -Runtime left to initiate shutdown (seconds): -: - -> If during a power failure, the remaining runtime seconds (as calculated internally by the UPS) is below or equal to *seconds*, NUT will initiate a system shutdown. -> **Note** depeding on your ups this value can "fluctuate" so be aware. if yot ups have an old battery dont use this - -Time on battery before shutdown (seconds): -: - -> The time in seconds before the system will power down if a power failure accours. - - -Turn off UPS after shutdown: -: - -> Set to *Yes* to turn off the power to the UPS after a shutdown. -> -> Check your bios and enable, "Automatically power on after power loss" so that the server starts again when powers is restored. - - -
- -> **Additional Notes** -> -> The usernames and passwords for *admin* and *slave* accounts in *upsd.users* file ** -> -> + **Admin Account**: "admin / adminpass" - **Slave Account**: "slaveuser / slavepass" -> -> NUT is set to listen on all interface in upsd.conf "LISTEN 0.0.0.0" -> -> macester (macecapri@gmail.com) - - -: -
- - diff --git a/source/nut/usr/local/emhttp/plugins/nut/README.md b/source/nut/usr/local/emhttp/plugins/nut/README.md deleted file mode 100755 index 9e82ca6f..00000000 --- a/source/nut/usr/local/emhttp/plugins/nut/README.md +++ /dev/null @@ -1,3 +0,0 @@ -####Network UPS Tools (NUT)#### - -A Plugin that supports a wide variety of UPS brands and models. diff --git a/source/nut/usr/local/emhttp/plugins/nut/icons/nutdetails.png b/source/nut/usr/local/emhttp/plugins/nut/icons/nutdetails.png deleted file mode 100644 index 55b2a5997b35464daec2ba910d5c5fcde7529ec8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 952 zcmV;p14sOcP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E;VI^GGzb&11U*FK~y+Tb(3pMQeha!>FQQ9q?>(cja;*A zt&v(3R_I(-TCSO7E?T8DvLa+jYHQ?7Gc;0a({#~RqG)Swc}Xm5i6oea2?|MY;IO!8 z+VWf8_V%39G;Qm@{XU%M?EgFGeb0F*^Rg6J2W*%}AV6dhFn>-!%ob#$LQzv=He>iV z_b9H>7|cv2iwpB5KtO(8eqnrke3s;vM4FhGD1_NEqC|wYe}7DBVPQ$B)#Ccmtv4Za zza1G3R`gK*_@!8!dn+(7=y+~+?(^8#LuKMDu_`X^NHO$+|I{gzP>rU?GC1f!IPOO_ z8;<&nR;1UNkXGA=y1M!&7>o#&!-4&DV$Lx)?jCnJU8B%r1LQK8j}+y;m#-S8J3e;K zG`2QPmp`qXDk?3WB#@PtP0~X)>r5sK`f9`A0l*N3pmzdTObB9Gq7aL)itDdK?U&rxG38@~7Psz0?c!V&#qb^om3 zUHe;9YEB^0>vbq0AzlW(Ab{LNQjn)hcU7BZqea>)BgwV9#-bEKo&!qiKxW1H?;fuQ z;clG7KkP$ENlCY%x11;w0RikmcRE)4MeZvx2;FCzBJHfIAm83{sz2)dj&VL;0I&a- zkdQ4B=*|5|fA*l8XRou#Jr9f`?A#mXz(EylaBsyb?@__N$)cjWsGy*LL@Je{@bK^j z0(P7{v{%xe=B)l)=96{^@zeE@R#p|&#FSHq4rlBe=kYEfk?1#+gL5PyRY5e}3CThR6^6`WUYUtef#4l{Wc>q^q1AD{3i*gXtiF_vfXek%}# z{oeVH8yLy6c(3}<2xkw^F^G#eiJy3dEYISXb;^GMkF8hGm*4Vk P00000NkvXXu0mjf9T&0r diff --git a/source/nut/usr/local/emhttp/plugins/nut/include/update.nut.php b/source/nut/usr/local/emhttp/plugins/nut/include/update.nut.php deleted file mode 100755 index ffac280f..00000000 --- a/source/nut/usr/local/emhttp/plugins/nut/include/update.nut.php +++ /dev/null @@ -1,32 +0,0 @@ - - diff --git a/source/nut/usr/local/emhttp/plugins/nut/scripts/rc.nut b/source/nut/usr/local/emhttp/plugins/nut/scripts/rc.nut deleted file mode 100755 index 92323dc5..00000000 --- a/source/nut/usr/local/emhttp/plugins/nut/scripts/rc.nut +++ /dev/null @@ -1,69 +0,0 @@ -#!/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 diff --git a/source/nut/usr/local/emhttp/plugins/nut/scripts/txt/udev.txt b/source/nut/usr/local/emhttp/plugins/nut/scripts/txt/udev.txt deleted file mode 100755 index 6251dc19..00000000 --- a/source/nut/usr/local/emhttp/plugins/nut/scripts/txt/udev.txt +++ /dev/null @@ -1,4 +0,0 @@ - -if [ -f /usr/local/emhttp/plugins/nut/scripts/nut_restart_udev ]; then - . /usr/local/emhttp/plugins/nut/scripts/nut_restart_udev -fi diff --git a/source/nut/usr/local/emhttp/plugins/nut/scripts/write_config.sh b/source/nut/usr/local/emhttp/plugins/nut/scripts/write_config.sh deleted file mode 100755 index 791c658d..00000000 --- a/source/nut/usr/local/emhttp/plugins/nut/scripts/write_config.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/bash -# -# NUT plugin configuration script for unRAID -# By macester macecapri@gmail.com -# -NUTCFG=/boot/config/plugins/nut/nut.cfg - - -# Killpower flag permissions -chmod 777 /etc/ups/flag - -# Add nut user and group for udev at shutdown -GROUP=$( grep -ic "218" /etc/group ) -USER=$( grep -ic "218" /etc/passwd ) - -if [ $GROUP -ge 1 ]; then - echo "NUT Group already configured" -else - groupadd -g 218 nut -fi - -if [ $USER -ge 1 ]; then - echo "NUT User already configured" -else - useradd -u 218 -g nut -s /bin/false nut -fi - -# Nut config files - -# Add the driver config -driver_custom=$( grep -ic 'DRIVER="custom"' $NUTCFG ) -if [ $driver_custom -eq 1 ]; then - var1=$( grep -i "SERIAL=" $NUTCFG|cut -d \" -f2|sed 's/^/driver = /' ) - sed -i "2 s/.*/$var1/" /etc/ups/ups.conf -else - var2=$( grep -i "DRIVER=" $NUTCFG|cut -d \" -f2|sed 's/^/driver = /' ) - sed -i "2 s/.*/$var2/" /etc/ups/ups.conf -fi - -# add the port -var3=$( grep -i "PORT=" $NUTCFG|cut -d \" -f2|sed 's/^/port = /' ) -sed -i "3 s~.*~$var3~" /etc/ups/ups.conf - -# add mode standalone/netserver -var4=$( grep -i "MODE=" $NUTCFG|cut -d \" -f2|sed 's/^/MODE=/' ) -sed -i "1 s/.*/$var4/" /etc/ups/nut.conf - -# Set which shutdown script NUT should use -mode_bat_level=$( grep -ic 'SHUTDOWN="batt_level"' $NUTCFG ) -mode_bat_timer=$( grep -ic 'SHUTDOWN="batt_timer"' $NUTCFG ) - -if [ $mode_bat_level -eq 1 ]; then - sed -i "6 s,.*,NOTIFYCMD \"/usr/local/emhttp/plugins/nut/scripts/notifycmd_batterylevel\"," /etc/ups/upsmon.conf -else - if [ $mode_bat_timer -eq 1 ]; then - sed -i "6 s,.*,NOTIFYCMD \"/usr/local/emhttp/plugins/nut/scripts/notifycmd_seconds\"," /etc/ups/upsmon.conf - else - sed -i "6 s,.*,NOTIFYCMD \"/usr/local/emhttp/plugins/nut/scripts/notifycmd_timeout\"," /etc/ups/upsmon.conf - fi -fi - -# Edit timers fo shutdown scripts - -# shutdown when battery gets to level -var5=$( grep -i "BATTERYLEVEL=" $NUTCFG|cut -d \" -f2|sed 's/^/BATTERYLEVEL=/' ) -sed -i "6 s/.*/$var5/" /usr/local/emhttp/plugins/nut/scripts/notifycmd_batterylevel - -# shutdown when battery time runs out -var6=$( grep -i "SECONDS=" $NUTCFG|cut -d \" -f2|sed 's/^/SECONDS=/' ) -sed -i "6 s/.*/$var6/" /usr/local/emhttp/plugins/nut/scripts/notifycmd_seconds - -# shutdown on user timer -var7=$( grep -i "TIMEOUT=" $NUTCFG|cut -d \" -f2|sed 's/^/TIMEOUT=/' ) -sed -i "6 s/.*/$var7/" /usr/local/emhttp/plugins/nut/scripts/notifycmd_timeout - -# Set if the ups should be turned off -ups_kill=$( grep -ic 'UPSKILL="enable"' $NUTCFG ) -if [ $ups_kill -eq 1 ]; then - var8='POWERDOWNFLAG /etc/ups/flag/killpower' - sed -i "3 s,.*,$var8," /etc/ups/upsmon.conf -else - var9='POWERDOWNFLAG /etc/ups/flag/no_killpower' - sed -i "3 s,.*,$var9," /etc/ups/upsmon.conf -fi - -# Link shutdown scripts for poweroff in rc.0 and rc.6 -UDEV=$( grep -ic "/usr/local/emhttp/plugins/nut/scripts/nut_restart_udev" /etc/rc.d/rc.6 ) -if [ $UDEV -ge 1 ]; then - echo "UDEV lines already exist in rc.0,6" -else - sed -i '/\/bin\/mount -v -n -o remount,ro \//r /usr/local/emhttp/plugins/nut/scripts/txt/udev.txt' /etc/rc.d/rc.6 -fi - -KILL=$( grep -ic "/usr/local/emhttp/plugins/nut/scripts/nut_kill_inverter" /etc/rc.d/rc.6 ) -if [ $KILL -ge 1 ]; then - echo "KILL_INVERTER lines already exist in rc.0,6" -else - sed -i -e '/# Now halt (poweroff with APM or ACPI enabled kernels) or reboot./r /usr/local/emhttp/plugins/nut/scripts/txt/kill.txt' -e //N /etc/rc.d/rc.6 -fi