<div dir="ltr"><div>Check it out now,</div><div>my NUT project braza!..<br><br><a href="https://github.com/networkupstools/nut/pull/2133">https://github.com/networkupstools/nut/pull/2133</a><br><a href="https://github.com/networkupstools/nut/wiki/Building-NUT-for-in%E2%80%90place-upgrades-or-non%E2%80%90disruptive-tests">https://github.com/networkupstools/nut/wiki/Building-NUT-for-in%E2%80%90place-upgrades-or-non%E2%80%90disruptive-tests</a></div><div><br></div><div>Jim</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 27, 2023 at 8:07 PM Jim Klimov <<a href="mailto:jimklimov%2Bnut@gmail.com">jimklimov+nut@gmail.com</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>Hi, this does sound like a useful idea - although for the principle of least surprise and for variation in deployments, I'd rather have it as a (non-default state of a) configuration toggle that can be set via `upsmon.conf`: whether this particular client exits after processing FSD or not. The onus for the rest would be on general systems integration - e.g. ensure that init scripts `K*`ill the long-running services before they go after upsmon and upsd, or add a drop-in systemd config snippet for nut-monitor to not-conflict with "shutdown.target" (and half a dozen of its equivalents for halt/reboot/poweroff/...), and possibly to break the shutdown-dependency between nut-monitor/nut-server/nut-driver units.</div><div><br></div><div>On a related note - there was lately work to allow daemonized drivers to kill power of the UPS (may be useful especially for devices with long protocol init times), with a safety switch to flip about this and actually allow the driver to issue killpower commands. So stopping driver daemons might eventually be not needed - but I'm not sure any OS integrations took note of this possibility yet. It was not officially released so far, just is in master branch.</div><div><br></div><div>Note however that typically FSD happens when the power is critical. Definitions of that vary, as well as ability or not to set certain thresholds for when the device would emit (and a driver would relay) the low-battery condition. You might not physically have those 2 minutes worth of remaining battery charge to shut down the VMs or other long-stopping services (e.g. app servers to flush in-flight operations, and only later their databases) - more so with the probable storage I/O and power-draw burst to flush out databases or hibernate those VMs.</div><div><br></div><div>In this case fiddling with upssched or setting up dummy-ups relays with an override for defining earlier trigger of critical state (usually by battery charge or time remaining) may fare better: your NUT primary server would seem to serve several UPSes (the "real" device and a few dummies with different "criticality" levels), and various secondary hosts would MONITOR the suitable dummy to begin their shutdown earlier into the outage. This approach may also be useful for Dan's post :)<br></div><div><br></div><div>Jim<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 27, 2023 at 4:55 PM Magnus Holmgren <<a href="mailto:magnus.holmgren@milientsoftware.com" target="_blank">magnus.holmgren@milientsoftware.com</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">Hi, and thanks for this great piece of free software! I've been meaning to <br>
sort this out for some time, but we don't get power outages that often, <br>
fortunately...<br>
<br>
So, correct me if I'm wrong, but from the documentation at https://<br>
<a href="http://networkupstools.org/docs/user-manual.chunked/" rel="noreferrer" target="_blank">networkupstools.org/docs/user-manual.chunked/</a><br>
Configuration_notes.html#UPS_shutdown, and also reading upsmon.c, when a UPS <br>
goes OB LB (assuming we have a single UPS connected to a primary and supplying <br>
power to the primary and some number of secondaries), the primary notifies the <br>
secondaries, the secondaries wait for FINALDELAY and then execute SHUTDOWNCMD <br>
immediately followed by exiting, thereby disconnecting from the primary, and <br>
the primary, after seeing all secondaries disconnect, proceed with its <br>
shutdown (only waiting for FINALDELAY), which ends with telling the UPS to cut <br>
the power (without delay too, right?).<br>
<br>
Again, correct me if I'm wrong, Is it only I who find this a bit flawed? I <br>
would like for the secondaries to stay connected until they shut down. We have <br>
a server with a bunch of virtual machines on, and they can take a couple of <br>
minutes to shut down. Otherwise the primary can easily cut the power <br>
prematurely. Avoiding this, it seems, could pretty easily be accomplished by <br>
having upsmon wait, perhaps in a separate loop, for the INT/TERM/QUIT signal <br>
(it would still be necessary to configure the service manager such that upsmon <br>
is terminated as late as possible). The primary could start shutting down its <br>
services in the meantime, but upsmon would hold the poweroff until the <br>
secondaries have disconnected (or HOSTSYNC expires).<br>
<br>
Surely this would be better than cranking up FINALDELAY on the primary and <br>
always waiting for a fixed period of time, as suggested in <a href="https://alioth-lists.debian.net/pipermail/nut-upsuser/2012-April/007550.html" rel="noreferrer" target="_blank">https://alioth-lists.debian.net/pipermail/nut-upsuser/2012-April/007550.html</a>? I guess I could <br>
try writing a SHUTDOWNCMD script that doesn't exit until most other services <br>
have also done so, taking care not to create a deadlock situation.<br>
<br>
Another option would be to use upssched to shut down the "big rig" earlier. It <br>
just seems unsatisfying to me that upssched is entirely time-based. It would <br>
be nice if it were easier to trigger off battery.charge or battery.runtime <br>
going below arbitrary values instead of just the on battery and low battery <br>
statuses.<br>
<br>
How do others solve this?<br>
<br>
-- <br>
Magnus Holmgren<br>
./¯\_/¯\. Milient<br>
(also <a href="mailto:holmgren@debian.org" target="_blank">holmgren@debian.org</a>)<br>
<br>
<br>
<br>
_______________________________________________<br>
Nut-upsuser mailing list<br>
<a href="mailto:Nut-upsuser@alioth-lists.debian.net" 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" target="_blank">https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser</a><br>
</blockquote></div>
</blockquote></div>