<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="">Hi,<div class=""><br class=""></div><div class="">I’ve posted my question on <a href="http://Superuser.com" class="">Superuser.com</a> but not had any replies in 2 weeks, so I guess no-one there knows anything about NUT.</div><div class=""><br class=""></div><div class=""><a href="https://superuser.com/questions/1441153/how-to-shutdown-macos-mac-osx-from-network-ups-tools-client-nut" class="">https://superuser.com/questions/1441153/how-to-shutdown-macos-mac-osx-from-network-ups-tools-client-nut</a></div><div class=""><br class=""></div><div class=""><div class="post-text" itemprop="text"><p class="">I’m looking for help in shutting down my iMac on detecting a power failure while running from a UPS.</p><p class="">My setup is an APC SMT750i UPS, powering two Synology NASs, an iMac, plus the network kit (router, switch etc.). This is all fine. (Synology runs a variant of Linux plus NUT). I have installed NUT (v
2.6.5) on the iMac (High Sierra 10.13.6) using MacPorts. One NAS is
connected directly to the UPS via USB and acts as the ‘master’ in the
NUT network, the other NAS and the iMac are ‘slaves’. </p><p class="">On power failure, the master detects the state of the UPS and
broadcasts it to the slaves, which both receive it OK. The NASs both go
into ‘safe mode’ correctly as they are configured to do. The iMac
receives the state change OK and repeatedly alerts the logged in user, <strong class="">but does NOT in fact shut down</strong>, as I want and believe I have configured it to do. </p><p class="">I have followed all the advice I can find online, especially at:</p><p class=""><a href="https://networkupstools.org/" rel="nofollow noreferrer" class="">https://networkupstools.org/</a></p><p class=""><a href="https://superuser.com/questions/1228972/how-to-automatically-launch-nut-client-at-boot-on-macos" class="">https://superuser.com/questions/1228972/how-to-automatically-launch-nut-client-at-boot-on-macos</a></p><p class=""><a href="https://diktiosolutions.eu/en/synology/synology-ups-nut-en/" rel="nofollow noreferrer" class="">https://diktiosolutions.eu/en/synology/synology-ups-nut-en/</a></p><p class=""><strong class=""><em class="">What am I doing wrong?</em></strong></p><p class="">Mac NUT config files:</p>
<h2 class="">etc/upsmon.conf</h2>
<pre class=""><code class="">RUN_AS_USER root
MONITOR <a href="mailto:ups@xxx.xxx.xxx.xxx" class="">ups@xxx.xxx.xxx.xxx</a> 1 monuser ****** slave
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -u -h +1"
NOTIFYCMD /opt/local/sbin/upssched
POLLFREQ 5
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 15
POWERDOWNFLAG /etc/killpower
NOTIFYFLAG ONLINE EXEC+SYSLOG+WALL
NOTIFYFLAG ONBATT EXEC+SYSLOG+WALL
NOTIFYFLAG LOWBATT EXEC+SYSLOG+WALL
NOTIFYFLAG FSD EXEC+SYSLOG+WALL
NOTIFYFLAG COMMOK EXEC+SYSLOG
NOTIFYFLAG COMMBAD EXEC+SYSLOG
NOTIFYFLAG SHUTDOWN EXEC+SYSLOG+WALL
NOTIFYFLAG REPLBATT EXEC+SYSLOG+WALL
NOTIFYFLAG NOCOMM EXEC+SYSLOG+WALL
NOTIFYFLAG NOPARENT EXEC+SYSLOG+WALL
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5
</code></pre>
<h2 class="">etc/upssched.conf</h2>
<pre class=""><code class="">CMDSCRIPT /opt/local/bin/upssched-cmd
PIPEFN /opt/local/var/db/ups/upssched/upssched.pipe
LOCKFN /opt/local/var/db/ups/upssched/upssched.lock
AT ONBATT <a href="mailto:ups@xxx.xxx.xxx.xxx" class="">ups@xxx.xxx.xxx.xxx</a> EXECUTE on-battery
AT ONLINE <a href="mailto:ups@xxx.xxx.xxx.xxx" class="">ups@xxx.xxx.xxx.xxx</a> EXECUTE ups-back-on-line
AT COMMBAD <a href="mailto:ups@xxx.xxx.xxx.xxx" class="">ups@xxx.xxx.xxx.xxx</a> START-TIMER upsgone 75
AT COMMOK <a href="mailto:ups@xxx.xxx.xxx.xxx" class="">ups@xxx.xxx.xxx.xxx</a> CANCEL-TIMER upsgone</code></pre><h2 class="">bin/upssched-cmd</h2>
<pre class=""><code class="">#! /bin/sh
case $1 in
upsgone)
logger -t upssched-cmd "Lost communication with UPS"
/usr/bin/osascript -e 'tell app (path to frontmost application as text) to display dialog "Lost contact with UPS server" buttons {"OK"} default button 1 with icon note'
;;
on-battery)
logger -t upssched-cmd "UPS is running on battery"
/usr/bin/osascript -e 'tell app "System Events" to display dialog "Power failure. Save your work" buttons {"OK"} default button 1'
;;
ups-back-on-line)
logger -t upssched-cmd "UPS is running on utility power"
/usr/bin/osascript -e 'tell app (path to frontmost application as text) to display dialog "Power restored to UPS" giving up after 600 buttons {"OK"} default button 1 with icon note'
;;
*)
logger -t upssched-cmd "Unrecognized command: $1"
/usr/bin/osascript -e "tell app (path to frontmost application as text) to display dialog \"upssched-cmd: unsupported command $1\" buttons {\"OK\"} default button 1 with icon caution"
;;
esac
</code></pre></div></div><div class=""><br class=""></div><div class=""><div class=""><font face="Courier New" class=""><b class="">iMac$ sudo /opt/local/sbin/upsmon -DDD</b></font></div><div class=""><font face="Courier New" class=""><b class="">Network UPS Tools upsmon 2.6.5-Unversioned directory</b></font></div><div class=""><font face="Courier New" class=""><b class="">kill: No such process</b></font></div><div class=""><font face="Courier New" class=""><b class=""> 0.000000<span class="Apple-tab-span" style="white-space:pre"> </span>UPS: <a href="mailto:ups@xxx.xxx" class="">ups@xxx.xxx</a>.xxx.xxx (slave) (power value 1)</b></font></div><div class=""><font face="Courier New" class=""><b class=""> 0.000319<span class="Apple-tab-span" style="white-space:pre"> </span>Using power down flag file /etc/killpower</b></font></div><div class=""><font face="Courier New" class=""><b class=""> 0.000603<span class="Apple-tab-span" style="white-space:pre"> </span>debug level is '3'</b></font></div><div class=""><font face="Courier New" class=""><b class=""> 0.004081<span class="Apple-tab-span" style="white-space:pre"> </span>Trying to connect to UPS [<a href="mailto:ups@192.168.86.242" class="">ups@192.168.86.242</a>]</b></font></div><div class=""><font face="Courier New" class=""><b class=""> 0.006152<span class="Apple-tab-span" style="white-space:pre"> </span>Logged into UPS <a href="mailto:ups@xxx.xxx.xxx.xxx" class="">ups@xxx.xxx.xxx.xxx</a> </b></font></div><div class=""><font face="Courier New" class=""><b class=""> 0.006166<span class="Apple-tab-span" style="white-space:pre"> </span>pollups: <a href="mailto:ups@xxx.xxx.xxx.xxx" class="">ups@xxx.xxx.xxx.xxx</a> </b></font></div><div class=""><font face="Courier New" class=""><b class=""> 0.006189<span class="Apple-tab-span" style="white-space:pre"> </span>get_var: <a href="mailto:ups@xxx.xxx" class="">ups@xxx.xxx</a>.xxx.xxx / status</b></font></div><div class=""><font face="Courier New" class=""><b class=""> 0.006566<span class="Apple-tab-span" style="white-space:pre"> </span>parse_status: [OL]</b></font></div><div class=""><font face="Courier New" class=""><b class=""> 0.006590<span class="Apple-tab-span" style="white-space:pre"> </span>parsing: [OL]</b></font></div><div class=""><font face="Courier New" class=""><b class=""> 0.006596<span class="Apple-tab-span" style="white-space:pre"> </span>ups_on_line: <a href="mailto:ups@xxx.xxx" class="">ups@xxx.xxx</a>.xxx.xxx (first time)</b></font></div><div class=""><font face="Courier New" class=""><b class=""> 0.006603<span class="Apple-tab-span" style="white-space:pre"> </span>Current power value: 1</b></font></div><div class=""><font face="Courier New" class=""><b class=""> 0.006608<span class="Apple-tab-span" style="white-space:pre"> </span>Minimum power value: 1</b></font></div><div class=""><font face="Courier New" class=""><b class=""> 5.007706<span class="Apple-tab-span" style="white-space:pre"> </span>pollups: <a href="mailto:ups@xxx.xxx.xxx.xxx" class="">ups@xxx.xxx.xxx.xxx</a> </b></font></div><div class=""><font face="Courier New" class=""><b class=""> 5.007759<span class="Apple-tab-span" style="white-space:pre"> </span>get_var: <a href="mailto:ups@xxx.xxx" class="">ups@xxx.xxx</a>.xxx.xxx / status</b></font></div><div class=""><font face="Courier New" class=""><b class=""> 5.008277<span class="Apple-tab-span" style="white-space:pre"> </span>parse_status: [OL]</b></font></div><div class=""><font face="Courier New" class=""><b class=""> 5.008296<span class="Apple-tab-span" style="white-space:pre"> </span>parsing: [OL]</b></font></div><div class=""><font face="Courier New" class=""><b class=""> 5.008305<span class="Apple-tab-span" style="white-space:pre"> </span>Current power value: 1</b></font></div><div class=""><font face="Courier New" class=""><b class=""> 5.008310<span class="Apple-tab-span" style="white-space:pre"> </span>Minimum power value: 1</b></font></div></div><div class=""><font face="Courier New" class=""><b class=""> :</b></font></div><div class=""><font face="Courier New" class=""><b class=""> :</b></font></div><div class=""><br class=""></div><div class="">There’s nothing NUT/UPS related in the /var/logs AFAICS</div><div class=""> </div><div class="">Thanks for any help or advice</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><div class=""><br class=""></div><br class="Apple-interchange-newline">
</div>
<br class=""></div></body></html>