Merk - Oliver
2017-Jan-11 08:29 UTC
[Nut-upsuser] NUT Client shuts down when performing runtime calibration on APC UPS
I've setup nas4free (latest version 11.0.0.4, which has NUT 2.7.4) in a VM and configured it via webinterface to my APC UPS and set "shutdown mode" to "UPS goes on battery" with a timer of 30s. Then I started runtime calibration on the UPS and after 30s nas4free has shut down! I think this is not the correct behavior, since the status was "OB CAL". The system should not shut down, if the UPS is on battery due to a runtime calibration running. Can someone help me understand, if this is a wrong behavior of NUT, or a wrong configuration of NUT by nas4free? Here are the configuration files of NUT, generated by nas4free: ----------------------------------------------------------------------------------------------------------- nas4free: etc# more ups.conf [ups] driver = snmp-ups port = 192.168.123.92 mibs=apcc ----------------------------------------------------------------------------------------------------------- nas4free: etc# more upsd.conf MAXAGE 15 MAXCONN 1024 LISTEN 127.0.0.1 3493 LISTEN ::1 3493 ----------------------------------------------------------------------------------------------------------- nas4free: etc# more upsmon.conf MONITOR ups at localhost 1 root <secret> master MINSUPPLIES 1 SHUTDOWNCMD "/sbin/shutdown -p now" NOTIFYCMD /usr/local/sbin/upssched POLLFREQ 5 POLLFREQALERT 5 HOSTSYNC 15 DEADTIME 15 POWERDOWNFLAG /var/etc/killpower NOTIFYFLAG ONLINE SYSLOG+WALL+EXEC NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC NOTIFYFLAG LOWBATT SYSLOG+WALL+EXEC NOTIFYFLAG FSD SYSLOG+WALL+EXEC NOTIFYFLAG COMMOK SYSLOG+WALL+EXEC NOTIFYFLAG COMMBAD SYSLOG+WALL+EXEC NOTIFYFLAG SHUTDOWN SYSLOG+WALL+EXEC NOTIFYFLAG REPLBATT SYSLOG+WALL+EXEC NOTIFYFLAG NOCOMM SYSLOG+WALL+EXEC NOTIFYFLAG NOPARENT SYSLOG+WALL+EXEC RBWARNTIME 43200 NOCOMMWARNTIME 300 FINALDELAY 5 ----------------------------------------------------------------------------------------------------------- nas4free: etc# more upssched.conf CMDSCRIPT /usr/local/bin/upssched-cmd PIPEFN /var/run/upssched.pipe LOCKFN /var/run/upssched.lock AT COMMOK * EXECUTE notify AT COMMBAD * EXECUTE notify AT REPLBATT * EXECUTE notify AT NOCOMM * EXECUTE notify AT FSD * EXECUTE forced-shutdown AT NOPARENT * EXECUTE notify AT SHUTDOWN * EXECUTE notify AT ONLINE * CANCEL-TIMER shutdown AT ONLINE * EXECUTE resume AT ONBATT * START-TIMER shutdown 30 AT ONBATT * EXECUTE shutdown-warning AT LOWBATT * START-TIMER shutdown AT LOWBATT * EXECUTE shutdown-warning ________________________ This email was scanned by Bitdefender
Roger Price
2017-Jan-11 10:29 UTC
[Nut-upsuser] NUT Client shuts down when performing runtime calibration on APC UPS
On Wed, 11 Jan 2017, Merk - Oliver wrote:> I've setup nas4free (latest version 11.0.0.4, which has NUT 2.7.4) in a > VM and configured it via webinterface to my APC UPS and set "shutdown > mode" to "UPS goes on battery" with a timer of 30s. > ----------------------------------------------------------------------------------------------------------- > nas4free: etc# more upssched.conf > CMDSCRIPT /usr/local/bin/upssched-cmd > PIPEFN /var/run/upssched.pipe > LOCKFN /var/run/upssched.lock > > AT COMMOK * EXECUTE notify > AT COMMBAD * EXECUTE notify > AT REPLBATT * EXECUTE notify > AT NOCOMM * EXECUTE notify > AT FSD * EXECUTE forced-shutdown > AT NOPARENT * EXECUTE notify > AT SHUTDOWN * EXECUTE notify > AT ONLINE * CANCEL-TIMER shutdown > AT ONLINE * EXECUTE resume > AT ONBATT * START-TIMER shutdown 30 > AT ONBATT * EXECUTE shutdown-warning > AT LOWBATT * START-TIMER shutdown > AT LOWBATT * EXECUTE shutdown-warningYou have specified AT ONBATT * START-TIMER shutdown 30 which means that in 30 seconds after an OB appearing, script "/usr/local/bin/upssched-cmd shutdown" will be called. I'm guessing that this script has forgotten to test for "CAL" in ups.status. You specify AT LOWBATT * START-TIMER shutdown without the timer value. To the best of my knowledge this is undefined in NUT. Safer to specify the timer value. Roger
Roger Price
2017-Jan-11 12:58 UTC
[Nut-upsuser] NUT Client shuts down when performing runtime calibration on APC UPS
On Wed, 11 Jan 2017, Merk - Oliver wrote:> nas4free: /# more /usr/local/bin/upssched-cmd > #!/bin/shI would strongly recommend specifying which script interpreter is to be used: dash, bash, csh, ksh, ... For example #!/bin/bash There seem to be too many case statements in this script.> case "${1}" in > shutdown-warning) > _shutdowntimer=`configxml_get "//ups/shutdowntimer"`; > _message="${_notifymessage}. > Shutdown imminent in ${_shutdowntimer} seconds.";; > > shutdown)This is where a test looking for the letters "CAL" in ups.status is needed. If found, then issue a modified message.> _message="${_notifymessage}. > Shutdown in progress."; > ONLINE) > _notifymessage="UPS ${UPSNAME} - Running on line power";;Isn't this just duplication? Can $1 really take the value ONLINE ?> case "${1}" in > shutdown-warning) > _shutdowntimer=`configxml_get "//ups/shutdowntimer"`; > _message="${_notifymessage}. > Shutdown imminent in ${_shutdowntimer} seconds.";; > > shutdown) > _message="${_notifymessage}.More duplication! Test needed here for "CAL" in ups.status. If found, no shutdown.> Shutdown in progress."; > shutdown -p now ${_message};;It looks as if this script needs a thorough code review. Roger
Matus UHLAR - fantomas
2017-Jan-11 13:10 UTC
[Nut-upsuser] NUT Client shuts down when performing runtime calibration on APC UPS
>On Wed, 11 Jan 2017, Merk - Oliver wrote: >>nas4free: /# more /usr/local/bin/upssched-cmd >>#!/bin/shOn 11.01.17 13:58, Roger Price wrote:>I would strongly recommend specifying which script interpreter is to >be used: dash, bash, csh, ksh, ... For example > > #!/bin/bash#!/bin/sh IS THE script interpreter... dash/bash/ksh should be compatible with such scripts. (csh is not and never was, but that's another story) I _strongly_ recomend _against_ using anything other, unless _really_, _really_ needed.>There seem to be too many case statements in this script.case statements should be ok here. If you have encountered any problem with it, just tell us. -- Matus UHLAR - fantomas, uhlar at fantomas.sk ; http://www.fantomas.sk/ Warning: I wish NOT to receive e-mail advertising to this address. Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu. Remember half the people you know are below average.
Apparently Analagous Threads
- NUT Client shuts down when performing runtime calibration on APC UPS
- NUT Client shuts down when performing runtime calibration on APC UPS
- FreeBSD backed with a PR1500LCDRT2U
- NUT Client shuts down when performing runtime calibration on APC UPS
- FreeBSD backed with a PR1500LCDRT2U