[Nut-upsuser] Shutdown variables

Simon Wilson
Sun, 27 Nov 2022 13:31:13 -0000

----- Message from Roger Price <roger at rogerprice.org> ---------
    Date: Sun, 27 Nov 2022 13:53:40 +0100 (CET)
    From: Roger Price <roger at rogerprice.org>
Subject: Re: [Nut-upsuser] Shutdown variables
      To: Simon Wilson via Nut-upsuser <nut-upsuser at
alioth-lists.debian.net>


> On Sun, 27 Nov 2022, Simon Wilson via Nut-upsuser wrote:
>
>> Per
>> https://networkupstools.org/docs/user-manual.chunked/ar01s06.html
>> 6.3, am I right in thinking, for my single server running NUT (in
>> standalone mode) with connected USB UPS:
>>
>> - when battery.charge reaches battery.charge.low: ups.status
>> triggers to "LB" and upsmon sets an FSD in motion
>> - upsmon waits FINALDELAY 5 seconds, and calls my shutdown command
>> (which then in sequence does a clean shutdown of my VMs before
>> calling the 'real' shutdown command)
>> - my server then shuts down and powers off
>>
>> Main question:
>>
>> "ups.delay.shutdown" - at what point does this variable kick
in? Is
>> ups.delay.shutdown the period in seconds after FSD that the UPS
>> will hard-shutdown, i.e. I need to ensure that my server can
>> complete clean shutdown in that duration?
>
> Yes, you do need to give your server sufficient time.
> My understanding is that the ups.delay.shutdown is overwritten by
> the offdelay option in file ups.conf.
>
> In the machine with which I type this, I have
>
>  rprice at titan ~ upsc Eaton ups.delay.shutdown
>  20
>  rprice at titan ~ grep offdelay /etc/nut/ups.conf
>          offdelay = 30
>
> See https://rogerprice.org/NUT/ConfigExamples.A5.pdf chapter 2.5,
> and chapter 2.7 line 77.
>
> Roger
>
> _______________________________________________


That is great, thank you. From reading that I also note the comment
that ondelay must be longer than offdelay.

My server takes 90s to 110s to do a full shutdown... but most of that
is a scripted VM close before "shutdown -h +0" is finally called. I
will do a timed test to be precise on the weekend, but until then I
have put:

[eaton5sx]
         driver = "usbhid-ups"
         port = "auto"
         vendorid = "0463"
         productid = "FFFF"
         desc = "Eaton 5SX"
         offdelay = 120
         ondelay = 125
         lowbatt = 30

...and restarted nut-driver. I then used upsc to confirm those
settings had applied, which they had.

When I time it and see how long the actual post-VM-close shutdown
takes I'll be able to reduce those significantly.

So, by my understanding from 2.6, my settings will trigger shutdown at
30% (42 mins of net runtime for this rack), the shutdown process will
run on the server, including the nutshutdown command
(/usr/lib/systemd/system-shutdown/nutshutdown on RH), which will then
tell the UPS to power off at offdelay +2mins, with (if power has
restored) a further 5 seconds before it can come back on (to ondelay).

I think I have got it, thank you again. That link's a very useful resource.

Simon.



--
Simon Wilson
M: 0400 12 11 16