I want to shutdown my linux server right after power outage while it's on UPS. UPS runs like for extra 30 mins. I know that some UPSs can shutdown servers automatically but this is not my case now.
So I've in my mind to ping my router (or a PC in the network) and if pinging fails this means power outage (there may be a problem with the network too but never mind) and script will run
"#shutdown now"
How can I do this?
Edit: UPS is feeding two small servers so I can't use serial port on it (at least for both of them at the same time) . Our powerplant in Cyprus destroyed by a blast so until I get UPS for each server I need a temporary solution. That's why I'm asking this.