Hi there!
I’m having trouble configuring NUT to shutdown the load when getting a low battery from the battery. Everything works but from my understanding, when arriving to call the shutdown script : /usr/sbin/nutshutdown
, the driver does not seem to be able to call this command properly to kill the load :
/lib/nut/"${driver}" -a "$cfg" -k
and since the load is still ON, the router reboot indefinitely but i’m unsure why. Here’s the part commanding the shutdown :
# Driver will wait 'offdelay' before shutting down
config_foreach shutdown_instance driver
# So this can happen
rm -f /var/run/killpower
poweroff
# And just in case
sleep 120
# Uh-oh failed to poweroff UPS
reboot -f
What confuses me is that, if I unplug the power from the router, the UPS shutdown after a short while like it was waiting for the router to stop polling when it has a low battery condition. But from my understanding, this is not the wanted behaviour since I should be able to command the immediate shutdown.
Here’s what works until now :
- Instant commands : ex : shutdown the load immediately.
- NUT CGI
- Low battery event.
- Wait for other systems running nutmon in secondary mode to shutdown.
- Start the shutdown sequence.
Here is the UPS model :
Back-UPS NS 1500M2
Here is the current OpenWRT version :
OpenWrt 22.03.5 r20134-5f15225c1e / LuCI openwrt-22.03 branch git-23.093.57104-ce20b4a
Here are the configuration files :
/etc/nut/hosts.conf
MONITOR BackUPS@localhost "BackUPS"
/etc/nut/nut.conf
MODE=netserver
/etc/nut/ups.conf
# Config file automatically generated from UCI config
[BackUPS]
driver = usbhid-ups
port = auto
/etc/nut/upsd.conf
# Config file automatically generated from UCI config
LISTEN 0.0.0.0 3493
MAXAGE 15
STATEPATH /var/run/nut
MAXCONN 1024
/etc/nut/upsd.users
# Config file automatically generated from UCI config
[nut]
password = password
actions = set
actions = fsd
instcmds = load.off
instcmds = shutdown.reboot
upsmon master
/etc/nut/upsmon.conf
# Config file automatically generated from UCI config
RUN_AS_USER nutmon
MINSUPPLIES 1
SHUTDOWNCMD "/usr/sbin/nutshutdown"
POLLFREQ 5
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 30
POWERDOWNFLAG /var/run/killpower
NOTIFYFLAG ONLINE SYSLOG
NOTIFYFLAG ONBATT SYSLOG
NOTIFYFLAG LOWBATT SYSLOG
NOTIFYFLAG FSD SYSLOG
NOTIFYFLAG COMMOK SYSLOG
NOTIFYFLAG COMMBAD SYSLOG
NOTIFYFLAG SHUTDOWN SYSLOG
NOTIFYFLAG REPLBATT SYSLOG
NOTIFYFLAG NOCOMM SYSLOG
NOTIFYFLAG NOPARENT SYSLOG
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5
CERTVERIFY 0
FORCESSL 0
MONITOR BackUPS@localhost 1 nut password master
/etc/nut/upsset.conf
I_HAVE_SECURED_MY_CGI_DIRECTORY
In other words;
Why is the UPS not shutting down when the low battery sequence is initiated?