Is there any way to detect when an uninterruptible power supply's backup battery starts being used? I would like to add an automatic shutdown to my server program if the u.p.s. is running on its battery.
A number of power supplies support this functionality and come with a driver which allows them to communicate with the PC, sending a shut down signal after a configurable amount of time of running on battery backup.
I would start by finding out if your UPS supports this feature and if not consider buying one that does.