I have installed NUT on my Raspberry Pi to monitor my Eaton UPS.
If there’s a power failure the UPS shutdown the RPI.
That’s OK.
But when the power comes back, the RPI restart
and then, reboots.
The timer in NOTIFYCMD
Code: Select all
let "n = 600"And I don’t get why.
This is the whole enchilada:
/etc/default/nut
Code: Select all
# start upsd
START_UPSD=yes
# start upsmon
START_UPSMON=yes
Code: Select all
[eaton]
driver = usbhid-ups
port = auto
desc = "Eaton3S"
Code: Select all
standalone
Code: Select all
# LISTEN <address> <port>
LISTEN 127.0.0.1 3493
LISTEN ::1 3493Code: Select all
[admin]
password = mypass
actions = SET
instcmds = ALL
[upsmon]
password = mypass
upsmon master
Code: Select all
MONITOR eaton@localhost 1 admin mypass master
MINSUPPLIES 1
FINALDELAY 5
SHUTDOWNCMD "sudo /sbin/shutdown -h +0"
NOTIFYCMD "/etc/nut/notifycmd"
NOTIFYFLAG ONBATT EXEC+SYSLOG+WALL
NOTIFYFLAG ONLINE EXEC+SYSLOG+WALL
NOTIFYCMD /etc/nut/notifycmd
/etc/nut/notifycmd
Code: Select all
#!/bin/bash
#
# NUT NOTIFYCMD script
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin
trap "exit 0" SIGTERM
if [ "$NOTIFYTYPE" = "ONLINE" ]
then
echo $0: power restored | wall
curl "command"
#sleep 5
# Cause all instances of this script to exit.
killall -s SIGTERM `basename $0`
fi
if [ "$NOTIFYTYPE" = "ONBATT" ]
then
echo $0: 10 minutes till system powers down... | wall
curl "command!"
# Loop with one second interval to allow SIGTERM reception.
let "n = 600"
while [ $n -ne 0 ]
do
sleep 1
let "n--"
done
echo $0: commencing shutdown | wall
upsmon -c fsd
fiI wish you can help me to find the reason of this issue..