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>
On Wednesday 01 January 2020 15:27:32 Manuel Wolfshant wrote:> 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>Excuse me for butting in, but this thread points out a concern of mine, to. But I should preface this with the fact that I have a 20kw nat gas fired standby with a sub 10 second startup time in the back yard. The ups really should be smart enough to take a delayed shutdown command and be able to do without further commanding from the monitoring nut running machine, something I would think on the minute or minute-thirty delay range, giving the controlling nut machine time to complete its own gracefull shutdown. Is this capability something that can be bought today? I don't see it being advertized in the propaganda when looking for replacement. So I've never completed the autoshutdown procedures, I just let it sit there and beep until it hits the LB limit. I do see in this new APC, a 120 second shutdown delay, but have not attemped to program for that yet. I should also hope that the disppearance of the OB status should result in cancelling any ups shutdown delays in progress. That I han't tested for either. Comments/suggestions? Cheers, Gene Heskett -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) If we desire respect for the law, we must first make the law respectable. - Louis D. Brandeis Genes Web page <http://geneslinuxbox.net:6309/gene>
On 1/1/2020 12:27 PM, Manuel Wolfshant wrote:> 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> > > > > _______________________________________________ > Nut-upsuser mailing list > Nut-upsuser at alioth-lists.debian.net > https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser >Thanks for the clarification, Manuel. This explains why the UPS itself did not shut down. Maybe NUT lacks an ability to do what I am looking for - turn off the ups unit?
On 1/1/2020 2:15 PM, grumpy at mailfence.com wrote:> > try upscmd -l >Wow! Thanks, that looks potentially helpful. More testing to be done. Happy new year.
On 1/1/2020 2:15 PM, grumpy at mailfence.com wrote:> try upscmd -l >This is a great suggestion. I was not even aware of this command. I can not turn off that freaking beeping. and the shutdown.stayoff seems to shut the UPS off entirely. It does seem to be one of those commands that are described here <https://networkupstools.org/docs/man/upscmd.html> as "paranoid" and requiring multiple invocations - at least on my Belkin UPS. Happy new year.
On Jan 1, 2020, at 3:27 PM, Manuel Wolfshant <wolfy at nobugconsulting.ro> wrote:> >> 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.But in the case of "upsdrvctl shutdown", upsdrvctl iterates through the drivers and calls them with "-k" to shutdown the UPS power. It expects "upsdrvctl stop" to have been run earlier, which shuts down the long-running driver process that poll the UPS during normal operation. https://github.com/networkupstools/nut/blob/v2.7.4/drivers/upsdrvctl.c#L343-L350 "usbhid-ups -k" tries several of the "shutdown.*" commands in order, which you can see if you add a few "-D" options to that command line. If your UPS does not respond to the usual shutdown commands (or ignores some of them in certain modes), the other commands mentioned elsewhere in this thread might work better.
On Wed, 1 Jan 2020, Gene Heskett wrote:> But I should preface this with the fact that I have a 20kw nat gas fired > standby with a sub 10 second startup time in the back yard. > > The ups really should be smart enough to take a delayed shutdown command > and be able to do without further commanding from the monitoring nut > running machine, something I would think on the minute or minute-thirty > delay range, giving the controlling nut machine time to complete its own > gracefull shutdown. > > Is this capability something that can be bought today? I don't see it > being advertized in the propaganda when looking for replacement.NUT is capable of managing timers and doing delayed UPS shutdowns for example by including an "offdelay = 90" declaration in ups.conf> Comments/suggestions?Perhaps I don't understand your setup. I assumed that when the 20kW standby generator takes over, it substitutes itself for the power utility. Your machining installation sees the wall power return, and upsd sees that the UPS status is now [OL]. No need to shutdown the UPS. Roger