From db2b39db09893f51b6b2b60f2f78e4879d8bb969 Mon Sep 17 00:00:00 2001 From: dmacias72 Date: Sun, 21 May 2017 14:27:50 -0600 Subject: [PATCH] move nut plugin to separate repo --- source/nut/etc/ups/nut.conf | 1 - .../local/emhttp/plugins/nut/NUTdetails.page | 36 --------- .../usr/local/emhttp/plugins/nut/default.cfg | 10 --- .../local/emhttp/plugins/nut/images/nut.png | Bin 2162 -> 0 bytes .../emhttp/plugins/nut/include/nut_status.php | 71 ------------------ .../nut/scripts/notifycmd_batterylevel | 30 -------- .../plugins/nut/scripts/notifycmd_seconds | 30 -------- .../plugins/nut/scripts/notifycmd_timeout | 30 -------- .../plugins/nut/scripts/nut_kill_inverter | 14 ---- .../plugins/nut/scripts/nut_restart_udev | 11 --- .../emhttp/plugins/nut/scripts/txt/kill.txt | 4 - 11 files changed, 237 deletions(-) delete mode 100755 source/nut/etc/ups/nut.conf delete mode 100644 source/nut/usr/local/emhttp/plugins/nut/NUTdetails.page delete mode 100755 source/nut/usr/local/emhttp/plugins/nut/default.cfg delete mode 100755 source/nut/usr/local/emhttp/plugins/nut/images/nut.png delete mode 100755 source/nut/usr/local/emhttp/plugins/nut/include/nut_status.php delete mode 100755 source/nut/usr/local/emhttp/plugins/nut/scripts/notifycmd_batterylevel delete mode 100755 source/nut/usr/local/emhttp/plugins/nut/scripts/notifycmd_seconds delete mode 100755 source/nut/usr/local/emhttp/plugins/nut/scripts/notifycmd_timeout delete mode 100755 source/nut/usr/local/emhttp/plugins/nut/scripts/nut_kill_inverter delete mode 100755 source/nut/usr/local/emhttp/plugins/nut/scripts/nut_restart_udev delete mode 100755 source/nut/usr/local/emhttp/plugins/nut/scripts/txt/kill.txt diff --git a/source/nut/etc/ups/nut.conf b/source/nut/etc/ups/nut.conf deleted file mode 100755 index 6529f5ed..00000000 --- a/source/nut/etc/ups/nut.conf +++ /dev/null @@ -1 +0,0 @@ -MODE=standalone diff --git a/source/nut/usr/local/emhttp/plugins/nut/NUTdetails.page b/source/nut/usr/local/emhttp/plugins/nut/NUTdetails.page deleted file mode 100644 index 2867e4f3..00000000 --- a/source/nut/usr/local/emhttp/plugins/nut/NUTdetails.page +++ /dev/null @@ -1,36 +0,0 @@ -Menu="NUTsettings" -Title="NUT Details" ---- - - - - - - -
KeyValueKeyValue
Please wait, retrieving UPS information...
diff --git a/source/nut/usr/local/emhttp/plugins/nut/default.cfg b/source/nut/usr/local/emhttp/plugins/nut/default.cfg deleted file mode 100755 index ca4afa9b..00000000 --- a/source/nut/usr/local/emhttp/plugins/nut/default.cfg +++ /dev/null @@ -1,10 +0,0 @@ -SERVICE="disable" -DRIVER="custom" -SERIAL="none" -PORT="auto" -MODE="standalone" -SHUTDOWN="sec_timer" -BATTERYLEVEL="20" -SECONDS="240" -TIMEOUT="240" -UPSKILL="disable" diff --git a/source/nut/usr/local/emhttp/plugins/nut/images/nut.png b/source/nut/usr/local/emhttp/plugins/nut/images/nut.png deleted file mode 100755 index d048eba3ddfe8a476fe015696ebd0bf9315eddaf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2162 zcmV-&2#xoNP)|7QRv0{q^33=;INka&>35jX*p(SZb(>t_Dn#xv!A3_lk z386@1XG0S#v@xxiD(OoSFit9xgiQ!mM1rLDj)Wkx6cGs`%YFJ`Uhdr8z3#o<4e5d1 zeRk%|nddp@IsfxNXT<+;38Qon`!1vjU>Mj7K9t0@t3{n9Umm?Kim4$z3v9-K*a12T zoGz*id}-vmD8|FUDgXq)7Pb>Ghi_L(MWrpMI+xB0e#cvTi{!SYKCEn0mD`BMWNHcDdYEqjwNyM`GW1%8=EX% z68+?sM`T+C8QHK1m5kHke_DvZ(>fn!M=TO)4)53 zYrsas7NJAngGpR#Ryp*!4)~<)^K)%e#n-jae0V)#FL*0v6qpc913Qzrc4an${sdU( zgpTE-(1(R8SOQpw^gQAZz!3JfBo5BcN1q?+InU|ClJ z!YCcWuG{_|XydP=CJ z*dX{DuIcJ%V$9oNgOm< zbsOstF>r6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cTdX7R(;A6q>fXRG+&{rutCr@+#P4Q*CW9e%l`y=*Vq*K@ZwAw?d zjDS~wR?NCT<1G0axDg8hNPLF*2(d4TgEtq0bO!3rJF+IQ0 - 'Online (trim)', - 'BOOST ONLINE' => 'Online (boost)', - 'OL' => 'Online', - 'ONBATT' => 'On battery', - 'COMMLOST' => 'Lost communication', - 'NOBATT' => 'No battery detected' -]; - -$red = "class='red-text'"; -$green = "class='green-text'"; -$orange = "class='orange-text'"; -$status = array_fill(0,6,"-"); -$all = $_GET['all']=='true'; -$result = []; - -if (file_exists('/var/run/upsmon.pid')) { - exec('/usr/bin/upsc ups 2>/dev/null', $rows); - for ($i=0; $i$val" : "$val") : "Refreshing..."; - break; - case 'battery.charge': - $status[1] = strtok($val,' ')<=10 ? "$val" : "$val"; - break; - case 'battery.runtime': - $val = $val/60; - $status[2] = strtok($val,' ')<=5 ? "$val" : "$val"; - break; - case 'ups.realpower.nominal': - $power = strtok($val,' '); - $status[3] = $power==0 ? "$val" : "$val"; - break; - case 'ups.load': - $load = strtok($val,' '); - $status[5] = $load>=90 ? "$val" : "$val"; - break; - } - if ($all) { - if ($i%2==0) $result[] = ""; - $result[]= "$key$val"; - if ($i%2==1) $result[] = ""; - } - } - if ($all && count($rows)%2==1) $result[] = ""; - if ($power && $load) $status[4] = ($load>=90 ? "" : "").intval($power*$load/100)." Watts"; -} -if ($all && !$rows) $result[] = "No information available"; - -echo "".implode('', $status).""; -if ($all) echo "\n".implode('', $result); -?> diff --git a/source/nut/usr/local/emhttp/plugins/nut/scripts/notifycmd_batterylevel b/source/nut/usr/local/emhttp/plugins/nut/scripts/notifycmd_batterylevel deleted file mode 100755 index 746811cd..00000000 --- a/source/nut/usr/local/emhttp/plugins/nut/scripts/notifycmd_batterylevel +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# -# NUT NOTIFYCMD script macester macecapri@gmail.com -PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin - -BATTERYLEVEL=20 - -trap "exit 0" SIGTERM -if [ "$NOTIFYTYPE" = "ONLINE" ] -then - echo $0: power restored | wall - /usr/local/emhttp/plugins/dynamix/scripts/notify -e "UPS Notification" -s "UPS is no longer on battery" -i "normal" - # Cause all instances of this script to exit. - killall -s SIGTERM `basename $0` -fi -if [ "$NOTIFYTYPE" = "ONBATT" ] -then - echo $0: System shuts down when battery reaches $BATTERYLEVEL % | wall - /usr/local/emhttp/plugins/dynamix/scripts/notify -e "UPS Notification" -s "UPS is on battery" -i "alert" - # Loop with one second interval to allow SIGTERM reception. - timer=$( /usr/bin/upsc ups|grep battery.charge:|awk '{print $2}' ) - while [ $timer -gt $BATTERYLEVEL ] - do - sleep 1 - timer=$( /usr/bin/upsc ups|grep battery.charge:|awk '{print $2}' ) - done - echo $0: commencing shutdown | wall - /usr/local/emhttp/plugins/dynamix/scripts/notify -e "UPS Notification" -s "UPS is shutting down unRAID" -i "alert" - upsmon -c fsd -fi diff --git a/source/nut/usr/local/emhttp/plugins/nut/scripts/notifycmd_seconds b/source/nut/usr/local/emhttp/plugins/nut/scripts/notifycmd_seconds deleted file mode 100755 index 96ea920d..00000000 --- a/source/nut/usr/local/emhttp/plugins/nut/scripts/notifycmd_seconds +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# -# NUT NOTIFYCMD script macester macecapri@gmail.com -PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin - -SECONDS=240 - -trap "exit 0" SIGTERM -if [ "$NOTIFYTYPE" = "ONLINE" ] -then - echo $0: power restored | wall - /usr/local/emhttp/plugins/dynamix/scripts/notify -e "UPS Notification" -s "UPS is no longer on battery" -i "normal" - # Cause all instances of this script to exit. - killall -s SIGTERM `basename $0` -fi -if [ "$NOTIFYTYPE" = "ONBATT" ] -then - echo $0: System shuts down when there is $SECONDS seconds left on the battery... | wall - /usr/local/emhttp/plugins/dynamix/scripts/notify -e "UPS Notification" -s "UPS is on battery" -i "alert" - # Loop with one second interval to allow SIGTERM reception. - timer=$( /usr/bin/upsc ups|grep battery.runtime:|awk '{print $2}' ) - while [ $timer -gt $SECONDS ] - do - sleep 1 - timer=$( /usr/bin/upsc ups|grep battery.runtime:|awk '{print $2}' ) - done - echo $0: commencing shutdown | wall - /usr/local/emhttp/plugins/dynamix/scripts/notify -e "UPS Notification" -s "UPS is shutting down unRAID" -i "alert" - upsmon -c fsd -fi diff --git a/source/nut/usr/local/emhttp/plugins/nut/scripts/notifycmd_timeout b/source/nut/usr/local/emhttp/plugins/nut/scripts/notifycmd_timeout deleted file mode 100755 index d61a9e22..00000000 --- a/source/nut/usr/local/emhttp/plugins/nut/scripts/notifycmd_timeout +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# -# NUT NOTIFYCMD script macester macecapri@gmail.com -PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin - -TIMEOUT=240 - -trap "exit 0" SIGTERM -if [ "$NOTIFYTYPE" = "ONLINE" ] -then - echo $0: power restored | wall - /usr/local/emhttp/plugins/dynamix/scripts/notify -e "UPS Notification" -s "UPS is no longer on battery" -i "normal" - # Cause all instances of this script to exit. - killall -s SIGTERM `basename $0` -fi -if [ "$NOTIFYTYPE" = "ONBATT" ] -then - echo $0: $TIMEOUT seconds till system powers down... | wall - /usr/local/emhttp/plugins/dynamix/scripts/notify -e "UPS Notification" -s "UPS is on battery" -i "alert" - # Loop with one second interval to allow SIGTERM reception. - let "n = $TIMEOUT" - while [ $n -ne 0 ] - do - sleep 1 - let "n--" - done - echo $0: commencing shutdown | wall - /usr/local/emhttp/plugins/dynamix/scripts/notify -e "UPS Notification" -s "UPS is shutting down unRAID" -i "alert" - upsmon -c fsd -fi diff --git a/source/nut/usr/local/emhttp/plugins/nut/scripts/nut_kill_inverter b/source/nut/usr/local/emhttp/plugins/nut/scripts/nut_kill_inverter deleted file mode 100755 index 405acccd..00000000 --- a/source/nut/usr/local/emhttp/plugins/nut/scripts/nut_kill_inverter +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# This file is part of Network UPS Tools build for Slackware Linux. -# It should be sourced in /etc/rc.d/rc.0 as part of the poweroff sequence. -# Here, we signal the UPS to shut off the power. -# Reference: http://www.mail-archive.com/nut-upsdev@lists.alioth.debian.org/msg01099.html -# To be sourced after the genpowerd block and before the actual halt. -if [ -f /etc/ups/flag/killpower ]; then - echo "----------------------------------------Shutting down UPS power!" - /usr/sbin/upsdrvctl shutdown - sleep 40 - echo "The UPS was not shut off properly, or the power came back in the" - echo "middle of the shutdown process, or USB communication failed." - sleep 10 -fi diff --git a/source/nut/usr/local/emhttp/plugins/nut/scripts/nut_restart_udev b/source/nut/usr/local/emhttp/plugins/nut/scripts/nut_restart_udev deleted file mode 100755 index 36c9bffa..00000000 --- a/source/nut/usr/local/emhttp/plugins/nut/scripts/nut_restart_udev +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -# This file is part of Network UPS Tools build for Slackware Linux. -# It should be sourced in /etc/rc.d/rc.0 as part of the poweroff sequence. -# Here, we restart udev so that the system is able to kill off the UPS inverter. -# Reference: http://www.mail-archive.com/nut-upsdev@lists.alioth.debian.org/msg01099.html -# To be sourced after the rootfs has been remounted read-only. -if [ -f /etc/ups/flag/killpower ]; then -echo "Restarting udev to be able to shut the UPS inverter off..." -/etc/rc.d/rc.udev start -sleep 10 -fi diff --git a/source/nut/usr/local/emhttp/plugins/nut/scripts/txt/kill.txt b/source/nut/usr/local/emhttp/plugins/nut/scripts/txt/kill.txt deleted file mode 100755 index 0ecf3025..00000000 --- a/source/nut/usr/local/emhttp/plugins/nut/scripts/txt/kill.txt +++ /dev/null @@ -1,4 +0,0 @@ -if [ -f /usr/local/emhttp/plugins/nut/scripts/nut_kill_inverter ]; then - . /usr/local/emhttp/plugins/nut/scripts/nut_kill_inverter -fi -