[Nut-upsuser] Possible to trigger commands based on slave disconnection?
Kevin P. Fleming
kevin at km6g.us
Mon Nov 23 11:24:58 GMT 2020
On Sun, Nov 22, 2020 at 4:54 PM Jim Klimov <jimklimov at cos.ru> wrote:
> Possibly ports' power and comms can be turned off/on separately at least on some vendors, which may need separate commands on ePDU shim side. Maybe you'd have to save switch config for ports to stay down after reboot. Otherwise it may make sense to put the switch onto a separately manageable outlet group of the UPS so you can turn that one on sone time after total boot by server command or after a delay counted by UPS itself.
Ahh... this is a good point. My switch won't store the port state
unless it is 'written to the boot config', so when the switch itself
loses power the config changes would be lost. The config can also be
persisted over SSH, but if multiple systems tried to do that at the
same time the results would be quite unpredictable.
> I don't think upsd currently has a way to call detailed shutdown logic, other than what you specify in SHUTDOWN_CMD - which may be a script, that does the complex logic of tracking accessibility and shutdowns for RPi's, and eventually (all clients down, timeout, UPS charge too low, ...) tells the NFS server and UPS to go down.
On the shutdown side, it turns out this would be pretty simple: on the
secondary systems, I'd use "shutdown -p +0" to force a poweroff, and
then add a custom script in the system 'poweroff' service to actually
cut off the power from the switch. This doesn't solve the persistence
issue though, so I have some more thinking to do on that front.
More information about the Nut-upsuser