Bonjour à tous
J’ai installé NU (sur un Raspberry Pi) pour monitorer un onduleur Eaton UPS.
S’il y a coupure de courant l’onduleur fait arrêter le RPI (ou le maintient en activité pendant 10 minutes).
Mais quand le courant revient, 10 minutes après le RPI se met à rebooter.
C’est le timer de NOTIFYCMD let "n = 600"
qui le fait rebooter après 10 mn (si je passe la valeur à 900, le RPI reboot après 15mn).
Et je ne comprends pas pourquoi.
Voici ma configuration :
/etc/default/nut
# start upsd
START_UPSD=yes
# start upsmon
START_UPSMON=yes
/etc/nut/ups.conf
[eaton]
driver = usbhid-ups
port = auto
desc = "Eaton3S"
/etc/nut/nut.conf
standalone
/etc/nut/upsd.conf
# LISTEN <address> <port>
LISTEN 127.0.0.1 3493
LISTEN ::1 3493
/etc/nut/upsd.users
[admin]
password = mypass
actions = SET
instcmds = ALL
[upsmon]
password = mypass
upsmon master
/etc/nut/upsmon.conf
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]
#!/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[/code]
Voilà.
J’espère que vous allez pouvoir m’aider car je tiens au peu de cheveux qui me reste.