[Nut-upsuser] turn UPS off after PC shutdown
Jim Klimov
jimklimov+nut at gmail.com
Thu Jun 19 09:34:55 BST 2025
Cool, congrats!
FWIW, with the current version it no longer aborts due to competition in
this case:
# upsmon -K
Network UPS Tools upsmon 2.8.3.4-4+g0264b1be1 (development iteration after
2.8.3)
Note: A previous upsmon instance is already running!
Usually it should not be running during OS shutdown,
which is when checking POWERDOWNFLAG makes most sense.
Using power down flag file /etc/killpower
Power down flag is not set
Jim
On Wed, Jun 18, 2025 at 3:30 PM Dario Novakovic via Nut-upsuser <
nut-upsuser at alioth-lists.debian.net> wrote:
>
> Ok, I've figured it out.
>
>
> File /etc/killpower actaully exists but command that is supposed to check
> for it (upsmon -K) incorrectly exits with "1". When I run that command in
> debug mode, it complained that nut service is still running
> So, it is some kind of timing problem "upsmon -K" is supposed to be run
> later in the shutdown procedure, when the nut service is stopped, I guess.
>
> $>upsmon -K
> Network UPS Tools upsmon 2.8.0
> Fatal error: A previous upsmon instance is already running!
> Either stop the previous instance first, or use the 'reload' command
>
>
>
> Anyway, I can check for the presence of the /etc/killpower file and turn
> the ups off, like it is suggested on the forums:
> if [ -f /etc/killpower ]; then until upsdrvctl shutdown; do sleep 1; done;
> fi
>
> This has to be added as "Trunas shutdown script".
>
>
>
>
> Thanks to Jim for inspiration :)
>
> Dario
>
>
>
>
>
>
> On Tuesday, June 17, 2025 at 02:12:35 PM GMT+2, Dario Novakovic via
> Nut-upsuser <nut-upsuser at alioth-lists.debian.net> wrote:
>
>
> Exactly Jim, this bothers me too much to give up :)
>
> My upsmon.conf *does contain* line: POWERDOWNFLAG /etc/killpower
>
> I checked for the existence of the file during shutdown with "/sbin/upsmon
> -K", and it exited with "1", meaning error: no POWERDOWNFLAG.
>
>
> It is actually Truenas 25.04, with NUT 2.8.0. This may be Truenas issue,
> but I would like to check NUT first.
>
> Now, for the logs: all I see about killpower is this line
> nut-monitor[2688]: Using power down flag file /etc/killpower
> and it is logged when NUT service is starting. Thats all. No errors.
>
>
> I attached log of the shutdown procedure. Truenas is configured to
> shutdown in 60 seconds after power failure, and that is OK, but nothing
> about "killpower".
>
>
> Now I wonder what creates POWERDOWNFLAG, and why it is not created. I
> attached shutdown log, removed uneeded lines. Truenas is configured to wait
> 60 seconds and if power is not restored it shuts down.
>
> Thanks,
> Dario
>
>
> _______________________________________________
> Nut-upsuser mailing list
> Nut-upsuser at alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/nut-upsuser/attachments/20250619/d44c928e/attachment.htm>
More information about the Nut-upsuser
mailing list