<div dir="auto"><div dir="auto">As a fellow Unifi user and starting to use NUT more thoroughly, I'm following you here.</div><div dir="auto"><br></div><div dir="auto">Background for others: Unifi routers, UDM and UDR and others, are Linux but complex and optimized for their environment; the hardware may vary, the software/OS is intended to run across their entire product line. It's generally secured, but allows ssh access with special config. Far more capable than most routers, it's "prosumer". I upgraded when my Orbi 960 setup wouldn't handle all my IoT devices and other high-end consumer gear couldn't either - Asus etc. Unifi gear handles several hundred devices easily, has Enterprise grade capabilities, and supports diverse and complex deployments.</div><div dir="auto"><br></div><div dir="auto">Erik,</div><div dir="auto"><br></div><div dir="auto">How and where are you triggering this? Are you running this on the UDR or ?</div><div dir="auto"><br></div><div dir="auto">If on UDR, I recall it's a custom Linux distro/deployment, so it prob has idiosyncrasies.</div><div dir="auto">Also, be aware of (lack of) persistence between updates.</div><div dir="auto"><br></div><div dir="auto">Thinking you could run NUT monitoring on another box (Pi/similar) then ssh in to shut the UDR down. (This is a great use case for a Pi Zero with its own battery backup.)</div><div dir="auto"><br></div><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Fri, Jun 13, 2025, 07:51 Erik De Boeck via Nut-upsuser <<a href="mailto:nut-upsuser@alioth-lists.debian.net" target="_blank" rel="noreferrer">nut-upsuser@alioth-lists.debian.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Dear all,</div><div><br></div><div>I would like to gracefully shut down my router (Unifi Dream Router (UDR)) after my secondary has shut off, and before my primary shuts off (or in any case, before the UPS powers down). Unfortunately, the router doesn't seem to support NUT, but I've written a bash script, with which I can shut it down as user <i>nut</i>, running command <i>sudo -H -u nut bash -c 'bash /var/lib/nut/NUT-scripts/shutdownrouter.sh'</i>). (I assume that if any script is to be run, it would be run as user <i>nut</i>.)</div><div><br></div><div>But now I'm trying to figure out how to call it, and I'm not sure...</div><div><ul><li>I assume in <i>upsmon.conf</i> there should be a line <i>NOTIFYFLAG FSD SYSLOG+WALL+EXEC</i>)<br>But then I wondered whether <i>FSD</i> was maybe too late a flag?</li><li>Then I assume <i>upssched.conf</i> plays a role. This is the current setup:<br><br>CMDSCRIPT /etc/nut/upssched-cmd.sh<br>PIPEFN /etc/nut/upssched.pipe<br>LOCKFN /etc/nut/upssched.lock<br>AT ONBATT * START-TIMER shutdown_timer 1200<br>AT ONLINE * CANCEL-TIMER shutdown_timer<br>AT LOWBATT * EXECUTE immediate_shutdown<br>AT COMMBAD * START-TIMER commbad_timer 1200<br>AT COMMOK * CANCEL-TIMER commbad_timer<br>AT NOCOMM * EXECUTE commbad_shutdown<br>AT SHUTDOWN * EXECUTE powerdown<br><br></li><li>Then I assume <i>upssched-cmd.sh</i> plays a role. This is the current setup:<br>#!/bin/sh<br><br>case $1 in<br> shutdown_timer)<br> logger -t upssched-cmd "UPS running on battery for too long, initiating shutdown"<br> /usr/sbin/upsmon -c fsd<br> ;;<br><br> immediate_shutdown)<br> logger -t upssched-cmd "UPS on battery critical, forced shutdown"<br> /usr/sbin/upsmon -c fsd<br> ;;<br><br> commbad_timer)<br> logger -t upssched-cmd "UPS communication failure persists, initiating shutdown"<br> /usr/sbin/upsmon -c fsd<br> ;;<br><br> commbad_shutdown)<br> logger -t upssched-cmd "UPS communication failed, initiating shutdown"<br> /usr/sbin/upsmon -c fsd<br> ;;<br><br> powerdown)<br> logger -t upssched-cmd "Executing powerdown command"<br> ;;<br><br> *)<br> logger -t upssched-cmd "Unrecognized command: $1"<br> ;;<br>esac</li></ul><div>Where should I squeeze in <i>/var/lib/nut/NUT-scripts/</i><i>shutdownrouter.</i>sh?</div></div><div><br></div><div>Thanks for anyone's help!</div><div><br></div><div>Kind regards,</div><div><br></div><div>Erik</div></div>
_______________________________________________<br>
Nut-upsuser mailing list<br>
<a href="mailto:Nut-upsuser@alioth-lists.debian.net" rel="noreferrer noreferrer" target="_blank">Nut-upsuser@alioth-lists.debian.net</a><br>
<a href="https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser" rel="noreferrer noreferrer noreferrer" target="_blank">https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser</a><br>
</blockquote></div><div data-smartmail="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div></div></div></div></div></div></div></div></div>