by Apreche · 1y ago · 0 comments
What it’s actually about how to automatically automatically trigger a command on a Linux computer (almost certainly a laptop) in the event that it switches from AC power to battery power.
The example given is your laptop is plugged it at a café. Someone steals it, which involves unplugging it from the wall. At the moment it is unplugged it automatically shuts down, locks itself, etc.
I wonder if the same approach will also work for a computer connected to a UPS. Probably not!
For big servers, the UPS's batteries might only give minutes of power, so they'd listen for such a signal to do an orderly shutdown.
Considering that my UPS appears as a battery in KDE when I plug the USB cable in, I wouldn't be surprised if it's treated the same as a laptop battery across most of the stack
This is still a logical use case, but it's not the mental image that immediately got conjured up after reading the title for me.
As for a UPS, I have a Synology NAS that can monitor an APC UPS over its serial USB port. When the UPS loses power or is told to gracefully shutdown, the NAS also gracefully shuts down.
You could achieve same thing if you unplug your battery.
For the APC, use nut :)