Getting power events
My SuSE Linux 10.1 system is connected to an APC battery backup, which it seems to detect as a generic battery. Is it possible to determine programatically (command line, PHP, C++, etc.) the power state of the system, meaning determine if it's running on AC power or the battery backup?
My ultimate objective is to have it send me a panic e-mail when the power goes out, and show the power state of the system on a web page through PHP (remember PHP can execute commands and read files as necessary). The system and all the necessary Internet connectivity is on the same battery backup, so it always stays on for a few minutes during a power failure.
Thanks for any help.
|