Page 1 of 1

Need help for an issue with NUT

Posted: Fri May 27, 2016 7:03 am
by Sventovit
Hi all.
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"
makes it reboot after 10 mn’s wait (if value is changed to 900, the RPI reboot after 15mn).

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
/etc/nut/ups.conf

Code: Select all

[eaton]
driver = usbhid-ups
port = auto
desc = "Eaton3S"
/etc/nut/nut.conf

Code: Select all

standalone
/etc/nut/upsd.conf

Code: Select all

# LISTEN <address> <port> 
LISTEN 127.0.0.1 3493 
LISTEN ::1 3493
/etc/nut/upsd.users

Code: Select all

[admin]
password = mypass
actions = SET
instcmds = ALL

[upsmon]
password = mypass
upsmon master
/etc/nut/upsmon.conf

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
And finally, 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

fi
That’s it.

I wish you can help me to find the reason of this issue..