17

I have several Linux servers connected to APC UPSs. They are connected to the UPS via USB and configured to shutdown if the UPS sends a signal that mains power has been lost and has not returned after a period of time. This works well. In addition they are configured via jumpers to automatically power on if power is lost and then returns. This also works well.

The scenario that is causing issues is when mains power is lost, and the server shuts down, but then mains power is restored before the UPS runs out. In that case we'd like the Server to start up again, but since power is never actually lost post-UPS, the server never sees a power-return event and therefore doesn't power on.

I'm hoping there exists a device that can plug into mains power pre-UPS, and sense the power return state and send wake up signals perhaps via Wake-on-Lan to preconfigured servers to wake them up once mains power has returned that someone can point me to.

Alternate suggestions are also appreciated, only thing I can't do is replace the server hardware, and I'd prefer to keep the same UPSs if possible.

InteXX
  • 713
  • 13
  • 31
bk.
  • 768
  • 1
  • 4
  • 13

6 Answers6

14

The typical scenario implemented when using UPS is:

  1. On power loss, the UPS notifies the software component on the system(s) connected to it.
  2. 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).
  3. UPS waits m seconds for the systems to halt, and cuts the power off.
  4. 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.
  5. 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.

Paweł Brodacki
  • 6,451
  • 19
  • 23
  • 1
    Thanks! I have everything above working except for step (3), my UPS doesn't cut power until the battery gets too low. Some of my servers may take up to several minutes to halt or shutdown fully and the time changes between shutdowns. Having the UPS pull power after a preconfigured time, I'll either be risking pulling power too soon, or waiting too long and risking power coming back on before the UPS pulls power and I never get my power-on signal to boot up. Perhaps what I need is a UPS that supports a back channel from the system so it pulls power as soon as the server(s) its powering halt. – bk. Sep 21 '11 at 13:08
  • 2
    Looking at the NUT Docs, I think the issue I'm facing is this, so I'll try the solution they recommend there. Thanks http://www.networkupstools.org/docs/FAQ.html#_i_8217_m_facing_a_power_race – bk. Sep 21 '11 at 13:15
9

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.

migabi
  • 154
  • 3
4

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.

3

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.

BillThor
  • 27,354
  • 3
  • 35
  • 69
1

If your BIOS has the possibility to set a power-up-time you could set it to 50 minutes after shutdown, if shutdown is triggered through the UPS-shutdown-signal.

So in your scenario the server would be up an running again after 50m + boot + shutdown-time latest.

Nils
  • 7,657
  • 3
  • 31
  • 71
-2

I like all of the previously mentioned ideas. I would like to suggest running the "NUT" server or the "WoL" server on a laptop, with the lid closed. This way, it can run for 4-6 hours just on battery alone. Some laptops can have 2 batteries installed at once for even long run times.

jftuga
  • 5,572
  • 4
  • 39
  • 50
  • you should read Paweł Brodacki's comment; the point of NUT or apcupsd is that the Linux server can be brought down _without turning off_. This means "last state" turns the server on again, at which point it turns on all the windows servers. Long-term battery backup is kind of completely the opposite here. – Michael Lowman Sep 21 '11 at 05:07
  • What about the WoL solution mentioned by migabi? – jftuga Sep 21 '11 at 06:22
  • they're the same idea. "turns on all the windows servers" is accomplished with WoL; you don't your "WoL box" to remain up because of the way you should be powering it down (namely, such that last state still works) – Michael Lowman Sep 21 '11 at 13:28