<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><blockquote type="cite" class="">On 9 Jun 2019, at 21:19, Roger Price <<a href="mailto:roger@rogerprice.org" class="">roger@rogerprice.org</a>> wrote:</blockquote><blockquote type="cite" class="">Using upssched and a upssched-cmd script to shut down the system is an alternative to using the builtin upsmon SHUTDOWNCMD on status [OB LB]. A upssched-cmd script can provide a managed shutdown well before [OB LB] is reached, but should the UPS reach that status upsmon's SHUTDOWNCMD will take over and enforce an emergency shutdown.<br class=""><br class=""><SNIP><br class=""><br class="">Your current setup in which upsmon performs the "emergency shutdown" on status [OB LB], and upssched + upssched-cmd are used merely to provide useful warnings is ok, but you should be clear that this is what you want to do.</blockquote></div><div class=""><br class=""></div><div class="">Thanks for the clarification. Yes, this is _exactly_ what I wanted to do</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><blockquote type="cite" class="">How about temporarily setting the battery.charge.low to some very high value:<br class=""><br class="">upsrw -s battery.charge.low=90 -u <user> -p sekret my-UPS<br class=""><br class="">I suggest adding something like the following lines to the top of upssched-cmd </blockquote><br class=""></div><div class="">Thanks for the suggestions. I’ve successfully done both of these, and see the message [FSD OB DISCHRG LB] 87% successfully output in a dialog. </div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="">On 9 Jun 2019, at 19:55, Charles Lepple <<a href="mailto:clepple@gmail.com" class="">clepple@gmail.com</a>> wrote:</div><div class=""><br class="">Hmm, I'm not sure what would make it log the shutdown message repeatedly, but something occurs to me: you are probably running a recent enough version of macOS that won't let NUT write to /etc (per upsmon.conf: "POWERDOWNFLAG /etc/killpower"). I don't remember why we recommend /etc (maybe the assumption was that /var would get unmounted, but /var is not frequently on a separate partition on OS X). Maybe /var/run/killpower would be better?<br class=""></div></blockquote></div><div class=""><br class=""></div><div class="">I’ve tried moving the powerdown flag file location to /var/run as you suggest (although since I run the nut client as root I was not expecting this to be an issue. I realise using root is not the best setup, but I don’t want to fall foul of permissions issues). Anyway, it makes no difference.</div><div class=""><br class=""></div><div class="">I see the following three broadcast messages in my terminal</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">UPS <a href="mailto:ups@xxx.xxx" class="">ups@xxx.xxx</a>.xxx.xxx: forced shutdown in progress</div><div class="">:</div><div class="">:</div><div class="">Executing automatic power-fail shutdown</div><div class="">:</div><div class="">:</div><div class="">Auto logout and shutdown proceeding </div><div class=""><br class=""></div><div class="">These are repeated every 15 seconds or so indefinitely, but no shutdown occurs, and I do not see the messages the actual shutdown command would send, so I believe this is NOT in fact being executed. Just to repeat: executing the shutdown command verbatim as root DOES shut the iMac down, quite aggressively!</div><div class=""><br class=""></div>The only thing I can see in the system.log that may be relevant is :-<div class="">Jun 10 22:06:36 Joes-iMac com.apple.xpc.launchd[1] (com.apple.xpc.launchd.domain.system): Session adoption is only allowed in user domains.</div><div class=""><br class=""></div><div class="">This message occurs at the approximate time the shutdown is requested. No idea what it means, or even if it’s related.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">So since this is behaving as expected, but not _functioning_ as expected (!), later this week I’ll try Roger’s "lightening strike" setup with upssched-cmd doing the heavy lifting…. </div><div class=""><br class=""></div><div class="">Thanks both for your advice; I’m beginning to lose the will to carry on though, but I’l have one more stab … :-)</div><div class=""><br class=""><div class="">
<div class=""><div style="font-family: Helvetica; orphans: 2; widows: 2; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span style="font-family: Verdana;" class=""><font color="#515151" class="">~Joe</font></span></div><div style="font-family: Helvetica; orphans: 2; widows: 2; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""></div><div style="font-family: Verdana; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="font-family: Helvetica; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""></div></div></div></div><br class="Apple-interchange-newline">
</div>
<div><br class=""><blockquote type="cite" class=""><div class="">On 9 Jun 2019, at 21:19, Roger Price <<a href="mailto:roger@rogerprice.org" class="">roger@rogerprice.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">On Sun, 9 Jun 2019, Joe Gervasio wrote:<br class=""><br class=""><blockquote type="cite" class="">This question undermines my reading of the documentation. I had thought that these were separate things: <br class=""> SHUTDOWNCMD "/sbin/shutdown -u -h +1" <br class=""> NOTIFYCMD /opt/local/sbin/upssched<br class="">I had assumed that the SHUTDOWNCMD would be used by the Nut client (upsmon) to shutdown the slave system, and that the NOTIFYCMD would be responsible for notifying users of what is going on. <br class="">But I am now inferring from your question, that use of the NOTIFYCMD supersedes or overrides the functionality of the former. Is that correct? So if I use a NOTIFYCMD, then I should implement the actual shutdown logic as well as the notification logic in that script, forgetting about SHUTDOWNCMD?<br class=""></blockquote><br class="">Using upssched and a upssched-cmd script to shut down the system is an alternative to using the builtin upsmon SHUTDOWNCMD on status [OB LB]. A upssched-cmd script can provide a managed shutdown well before [OB LB] is reached, but should the UPS reach that status upsmon's SHUTDOWNCMD will take over and enforce an emergency shutdown.<br class=""><br class="">I live in an area with a lot of lightning and frequent power failures, so I have to be able to perform several managed shutdowns before [LB] is reached. I do this with upssched-cmd. Other sysadmins do not have this problem, and prefer something simpler, so they rely solely on builtin upsmon SHUTDOWNCMD.<br class=""><br class="">Your current setup in which upsmon performs the "emergency shutdown" on status [OB LB], and upssched + upssched-cmd are used merely to provide useful warnings is ok, but you should be clear that this is what you want to do.<br class=""><br class=""><blockquote type="cite" class="">Is there some way I can test my setup without having to deplete and recharge my UPS every iteration?<br class=""></blockquote><br class="">How about temporarily setting the battery.charge.low to some very high value:<br class=""><br class=""> upsrw -s battery.charge.low=90 -u <user> -p sekret my-UPS<br class=""><br class="">I suggest adding something like the following lines to the top of upssched-cmd so that you can include the value of $CHMSG in all your messages.<br class=""><br class=""> STATUS=$( upsc $UPS ups.status )<br class=""> CHARGE=$( upsc $UPS battery.charge )<br class=""> CHMSG="[$STATUS]:$CHARGE%"<br class=""><br class="">This will give you a clearer idea of what is happening to the UPS unit.<br class=""><br class="">Roger_______________________________________________<br class="">Nut-upsuser mailing list<br class=""><a href="mailto:Nut-upsuser@alioth-lists.debian.net" class="">Nut-upsuser@alioth-lists.debian.net</a><br class="">https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser</div></div></blockquote></div><br class=""></div></body></html>