How to wake a server after UPS Shuts it down when Mains power is restored?
The typical scenario implemented when using UPS is:
- On power loss, the UPS notifies the software component on the system(s) connected to it.
- If the power is lost longer than n seconds, the UPS driver notifies the UPS and halts the system without powering it off (this is important).
- UPS waits m seconds for the systems to halt, and cuts the power off.
- When the power is restored and UPS battery is charged above minimum (so that it can support a power on and clean shut-down in case power is lost right after machines start booting), UPS restores the power to the systems.
- Systems notice (at BIOS/UEFI level), that they were powered on before they lost power, so they boot up.
In most server BIOSes you can set the system to restore power state from before power loss. This means, that if the server is powered down and power is lost, it will remain powered down after you plug it in. On the other hand, if it was powered on, when the power was lost, it will power up when AC is restored.
NUT mentioned by BillThor should allow you to realize this scenario.
This problem I solved by using one small linux box (Asus wl deluxe or smth) which was plugged into main UPS and wake ASAP as the power was restored. The startup script include a 5 min delay to avoid any variations in power status (up/down), WOL-ed all servers (all w2k3, one linux) and sms me with the status.
After reading many suggestions, I think that a good solution is to use any old computer (if you don't care about power consumption), or some kind of raspberry pi, connected direct to energy.
So, when power goes up, one script will check if servers is on, and if not, then send a OWL through network.
I use NUT (Network UPS Tool) for cases like this. You will need a Unix/Linux based server to monitor the UPS. Once the shutdowns start, it will ensure the UPS is power cycled. This will bring the servers back up if they restart on when power is restored.
There is a client for Windows servers so they can be shut down cleanly.