[Nut-upsuser] Doing things before shutdown

Kari Lempiainen kari.lempiainen at summerday.net
Mon Nov 15 12:05:16 GMT 2021


What would be the preferred way to do some operations just before UPS is about to lose its power? I need to shut down some remote devices which are connected to the same UPS as my Nut server. They are not "NUT compatible" so I need to prepare them for losing power with some scripts. The complete shutdown of these devices takes about 120-150 seconds.

My first instinct was to call those scripts from the SHUTDOWNCMD. Then I realised that Nut might ask UPS to shut down before that. But this could be modified by offdelay in ups.conf, right?

Second thought was to NOTIFYCMD and upssched.conf with upssched-cmd script. And catch the LOWBATT event there and call my shutdown scripts. Then I read that even that could be interrupted by system (and UPS) shutdown, before letting LOWBATT event to do it's magic.

Is it really so that there is no "safe" way to deal with notification event LOWBATTERY? Will Nut start the shutdown procedure around same time when it receives "[ob lb]" from UPS and it doesn't wait for LOWBATTERY event to be processed? I know that in my setup UPS will have power for more than 180 seconds after reaching 20% battery level.

So is the only safe option to use ONBATT event and use START-TIMER method with upssched.conf?

Cheers,

Kari

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/nut-upsuser/attachments/20211115/b1957159/attachment.htm>


More information about the Nut-upsuser mailing list