Rob Groner
2015-May-22 21:25 UTC
[Nut-upsuser] Are UPS shutdown commands automatically sent?
Roger, So I'm pursuing the strategy of issuing the "upsdrvctl shutdown" command script when the OS (Porteus, in this case) is shutting down. I so far can't get it to do it, but I'm sure I'll overcome it, but I realized something else might be a problem. Won't that script execute every time Linux is shutting down, including rebooting? So, if I choose to reboot my system, I would most likely see the UPS shutoff and then turn back on, somewhere in the middle of my system booting back up. I can think of a couple solutions: 1) Have the script verify that the UPS is actually in a OB state before giving the shutdown command. That should prevent unintended UPS power cycles when simply rebooting the system. 2) Have the UPS itself not respect any "load.off.delay" or similar commands when it is online. Looking over UPS documentation and various helps, it seems most people would expect their UPS to turn the load off and then back on, even if it has wall power the entire time. That would facilitate testing at a minimum. So I'm guessing option #2 isn't a good one. Is #1 the correct way to deal with this? Or am I misunderstanding the problem (as in, there IS no problem)? It seems like this would have been dealt with before by people who interact with UPS and NUT more often than I. Sincerely, Robert G. Groner Software Engineer RTD Embedded Technologies, Inc. ISO 9001 and AS9100 Certified Ph: 814-234-8087 www.rtd.com -----Original Message----- From: Roger Price [mailto:roger at rogerprice.org] Sent: Thursday, May 21, 2015 3:59 PM To: Rob Groner Subject: Re: [Nut-upsuser] Are UPS shutdown commands automatically sent? On Thu, 21 May 2015, Rob Groner wrote:> I?m testing that my system will shutdown when the UPS has been on > battery for 10 seconds.? That all works fine?.10 seconds after pulling > the plug, my system does shut down.? However, I am not getting the > commands into the UPS telling it to power off and then power on.? I had thought I read somewhere that these commands are sent automatically when ?upsmon ?c fsd? happens?but I can?t find that, nor can I find any clear instructions on where I would put the commands to tell the UPS to start its shutdown and restart timers.Hi, I went through the same learning curve. I wrote up my notes at http://rogerprice.org/NUT.html Perhaps there is something there that could help you. Best Regards, Roger
Roger Price
2015-May-23 10:02 UTC
[Nut-upsuser] Are UPS shutdown commands automatically sent?
On Fri, 22 May 2015, Rob Groner wrote:> So I'm pursuing the strategy of issuing the "upsdrvctl shutdown" command > script when the OS (Porteus, in this case) is shutting down. I so far > can't get it to do it, but I'm sure I'll overcome it, but I realized > something else might be a problem. > > Won't that script execute every time Linux is shutting down, including > rebooting? So, if I choose to reboot my system, I would most likely see > the UPS shutoff and then turn back on, somewhere in the middle of my > system booting back up.Hello Robert, The command /sbin/shutdown -r used to reboot the box is incompatible with a UPS which receives a delayed shutdown order. If you have offdelay = 30 in /etc/ups/ups.conf, then 30 seconds after the upsdrvctl shutdown, when the box has now probably restarted, the UPS will shutdown with total loss of power to the box. Not good.> I can think of a couple solutions: 1) Have the script verify that the > UPS is actually in a OB state before giving the shutdown command. That > should prevent unintended UPS power cycles when simply rebooting the > system. 2) Have the UPS itself not respect any "load.off.delay" or > similar commands when it is online.This adds complexity, and in a critical system component simplicity is a virtue. To reboot my box, I turn off the wall power and wait until I hear the "clunk" as the shutdown relay operates in the UPS. I then turn the wall power back on.> Looking over UPS documentation and various helps, it seems most people > would expect their UPS to turn the load off and then back on, even if it > has wall power the entire time. That would facilitate testing at a > minimum. So I'm guessing option #2 isn't a good one.If you have decided to use a UPS capable of shutting down and restarting when wall power comes back, then you have to respect the UPS cycle. You can't pretend it isn't there. Best regards, Roger
Rob Groner
2015-May-27 14:31 UTC
[Nut-upsuser] Are UPS shutdown commands automatically sent?
Roger, Following your guide, it now works great, shutting down the UPS after the system has shutdown. I went with the bash script method. I have noticed, however, that the command to the UPS to do the delayed shutdown comes RIGHT as openSUSE is shutting down. While that is a good thing as far as timing and the potential race is concerned, I have seen it once where the UPS received the command to do the delayed shutdown, but *not* the command to do the delayed restart. While that's not a critical failure, it would be if the UPS doesn't get the delayed shutdown command instead. I'm wondering if the system (openSUSE ) died before that particular command could be sent over USB to the UPS. Sincerely, Robert G. Groner Software Engineer RTD Embedded Technologies, Inc. ISO 9001 and AS9100 Certified Ph: 814-234-8087 www.rtd.com -----Original Message----- From: Nut-upsuser [mailto:nut-upsuser-bounces+rgroner=rtd.com at lists.alioth.debian.org] On Behalf Of Roger Price Sent: Saturday, May 23, 2015 6:02 AM To: nut-upsuser Mailing List Subject: Re: [Nut-upsuser] Are UPS shutdown commands automatically sent? On Fri, 22 May 2015, Rob Groner wrote:> So I'm pursuing the strategy of issuing the "upsdrvctl shutdown" > command script when the OS (Porteus, in this case) is shutting down. > I so far can't get it to do it, but I'm sure I'll overcome it, but I > realized something else might be a problem. > > Won't that script execute every time Linux is shutting down, including > rebooting? So, if I choose to reboot my system, I would most likely > see the UPS shutoff and then turn back on, somewhere in the middle of > my system booting back up.Hello Robert, The command /sbin/shutdown -r used to reboot the box is incompatible with a UPS which receives a delayed shutdown order. If you have offdelay = 30 in /etc/ups/ups.conf, then 30 seconds after the upsdrvctl shutdown, when the box has now probably restarted, the UPS will shutdown with total loss of power to the box. Not good.> I can think of a couple solutions: 1) Have the script verify that the > UPS is actually in a OB state before giving the shutdown command. > That should prevent unintended UPS power cycles when simply rebooting > the system. 2) Have the UPS itself not respect any "load.off.delay" or > similar commands when it is online.This adds complexity, and in a critical system component simplicity is a virtue. To reboot my box, I turn off the wall power and wait until I hear the "clunk" as the shutdown relay operates in the UPS. I then turn the wall power back on.> Looking over UPS documentation and various helps, it seems most people > would expect their UPS to turn the load off and then back on, even if > it has wall power the entire time. That would facilitate testing at a > minimum. So I'm guessing option #2 isn't a good one.If you have decided to use a UPS capable of shutting down and restarting when wall power comes back, then you have to respect the UPS cycle. You can't pretend it isn't there. Best regards, Roger _______________________________________________ Nut-upsuser mailing list Nut-upsuser at lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser