On 1/1/2020 2:21 AM, Roger Price wrote:> On Tue, 31 Dec 2019, David White wrote: > >> ... But it did not actually turn off the UPS at all. The UPS kept >> beeping and I had to turn it off manually. >> >> I thought that NUT would handle this. But perhaps it cannot for my >> unit? Or perhaps I have things improperly configured? Any suggestions? >> Thanks and happy new year! > >> ########### /etc/nut/upsmon.conf ########### >> MONITOR belkinusb at localhost 1 local_mon ********* master >> MINSUPPLIES 1 >> SHUTDOWNCMD "/sbin/shutdown -h +0" >> NOTIFYCMD /home/android/nutShutdown.sh >> POLLFREQ 5 >> POLLFREQALERT 5 >> HOSTSYNC 15 >> DEADTIME 15 >> POWERDOWNFLAG /etc/killpower >> NOTIFYMSG ONBATT "UPS %s on battery" >> NOTIFYFLAG ONBATT WALL+EXEC >> RBWARNTIME 43200 >> NOCOMMWARNTIME 300 >> FINALDELAY 5 > >> ########### /etc/nut/upssched.conf ########### >> CMDSCRIPT /bin/upssched-cmd > > Happy New Year David!, The command "/sbin/upsdrvctl shutdown" turns off > the UPS unit, but this is not being executed. How do you plan to shut > down on power failure? Will you wait for upsd's [LB] status or use a > timer? The simplest is to wait for [LB], but the upsmon.conf contains > no declarations for NOTIFYFLAG LOWBATT. > > The script /home/android/nutShutdown.sh will be called when wall power > fails, but nut-report was unable to show its contents. Should > nutShutdown.sh perform the system shutdown? > > Perhaps a more complete set of NOTIFYFLAG and NOTIFYMSG declarations > will make things clearer. I would also recommend adding the SYSLOG > option to the declarations. > > Do you shutdown using systemd? > > Roger >Hi Roger and, as always, thanks! I really do not want to wait very long before shutting down things on this UPS. What I think I am doing (or at least trying to do) is to execute a script on the host machine when the UPS is detected by NUT to be on battery power. That script sleeps 20 seconds to ensure that this was not just a power blip (which happens here often) but a real power outage. After 20 seconds, the script checks the UPS status via upsc and if it is no longer OB, power is deemed restored and the script exits. If, after 20 seconds, UPS status remains OB then the event is deemed a true power outage and I want to shut down what I can cleanly. To do this, the script issues remote shutdown commands to a set of network connected devices also living on this UPS (but sadly not able to run NUT). As its final step, it issues a command to shut the host machine down. It seems from what you say above, I need to issue "/sbin/upsdrvctl shutdown" in there somewhere - obviously before I shut the host machine down. I will have to test this to see exactly what that command does. When run w/out arguments, the usage says shutdown shuts down UPS drivers. I am not clear if this means that the UPS itself will be powered off or if simply NUT is shutdown. Thanks
On 1/1/2020 11:49 AM, David White wrote:> > Hi Roger and, as always, thanks! > > I really do not want to wait very long before shutting down things on > this UPS. What I think I am doing (or at least trying to do) is to > execute a script on the host machine when the UPS is detected by NUT to > be on battery power. > > That script sleeps 20 seconds to ensure that this was not just a power > blip (which happens here often) but a real power outage. After 20 > seconds, the script checks the UPS status via upsc and if it is no > longer OB, power is deemed restored and the script exits. > > If, after 20 seconds, UPS status remains OB then the event is deemed a > true power outage and I want to shut down what I can cleanly. To do > this, the script issues remote shutdown commands to a set of network > connected devices also living on this UPS (but sadly not able to run > NUT). As its final step, it issues a command to shut the host machine down. > > It seems from what you say above, I need to issue "/sbin/upsdrvctl > shutdown" in there somewhere - obviously before I shut the host machine > down. I will have to test this to see exactly what that command does. > When run w/out arguments, the usage says shutdown shuts down UPS > drivers. I am not clear if this means that the UPS itself will be > powered off or if simply NUT is shutdown. > > Thanks > >Well, I just tried "/sbin/upsdrvctl shutdown" and while I see some output and a message shutting down in 30 seconds, nothing happens to the host machine or the UPS. Hmmm.
On 1/1/20 9:56 PM, David White wrote:> > > On 1/1/2020 11:49 AM, David White wrote: >> >> Hi Roger and, as always, thanks! >> >> I really do not want to wait very long before shutting down things on >> this UPS. What I think I am doing (or at least trying to do) is to >> execute a script on the host machine when the UPS is detected by NUT to >> be on battery power. >> >> That script sleeps 20 seconds to ensure that this was not just a power >> blip (which happens here often) but a real power outage. After 20 >> seconds, the script checks the UPS status via upsc and if it is no >> longer OB, power is deemed restored and the script exits. >> >> If, after 20 seconds, UPS status remains OB then the event is deemed a >> true power outage and I want to shut down what I can cleanly. To do >> this, the script issues remote shutdown commands to a set of network >> connected devices also living on this UPS (but sadly not able to run >> NUT). As its final step, it issues a command to shut the host machine >> down. >> >> It seems from what you say above, I need to issue "/sbin/upsdrvctl >> shutdown" in there somewhere - obviously before I shut the host machine >> down. I will have to test this to see exactly what that command does. >> When run w/out arguments, the usage says shutdown shuts down UPS >> drivers. I am not clear if this means that the UPS itself will be >> powered off or if simply NUT is shutdown. >> >> Thanks >> >> > Well, I just tried "/sbin/upsdrvctl shutdown" and while I see some > output and a message shutting down in 30 seconds, nothing happens to > the host machine or the UPS. Hmmm.that command only stops the drivers. generally speaking, upsdrvctl operates *only* on the drivers. pi at pi:~# upsdrvctl --help Network UPS Tools - UPS driver controller 2.7.4 upsdrvctl: invalid option -- '-' Starts and stops UPS drivers via ups.conf. usage: upsdrvctl [OPTIONS] (start | stop | shutdown) [<ups>] -h display this help -r <path> drivers will chroot to <path> -t testing mode - prints actions without doing them -u <user> drivers started will switch from root to <user> -D raise debugging level start start all UPS drivers in ups.conf start <ups> only start driver for UPS <ups> stop stop all UPS drivers in ups.conf stop <ups> only stop driver for UPS <ups> * shutdown shutdown all UPS drivers in ups.conf* shutdown <ups> only shutdown UPS <ups> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://alioth-lists.debian.net/pipermail/nut-upsuser/attachments/20200101/d33fe62c/attachment.html>