Short Version: How do I get 2 computers to shutdown when a UPS battery gets low?

Long Version:

I have an APC UPS, the RS 1500. It has a USB cord that goes into my main dev computer. My dev computer will shutdown when the battery gets low.

However, in addition, I have now hooked up a database server to the same UPS.

How can I have that database server also know that it needs to shut down when the battery gets low?

  • What OS is your dev machine running? – Scott Pack Jan 30 '10 at 20:34
  • What OS are both machines running? It's a simple enough problem to solve with a little scripting but the details depend an what you're running. – John Gardeniers Jan 30 '10 at 21:09
  • Windows 7 (dev) Windows 2003 (Db) – Brian Webster Jan 30 '10 at 23:46
  • 1
    Inside your shutdown script on the dev machine add a line to use psshutdown to send the shutdown command to the other machine. – John Gardeniers Jan 31 '10 at 2:44
  • 1
    Don't forget to put the switch on the USV too! – Turbo J May 5 '11 at 23:11

As Chopper3 writes, more expensive UPS' can have an option to attach networked shutdown software (for an additional cost).

For a free-of-charge implementation of networked power management you want APC UPS Daemon, apcupsd. Basically you install a manager instance of apcupsd on the PC that has the USB signalling cable attached, and install apcupsd clients on other PCs attached to the UPS power. The apcupsd instances use the LAN to communicate.

Apcupsd comes in both Unix and Windows versions, and the Windows versions have existed for quite some time, so I'd expect them to be stable enough. I don't know how easy it is to set up and configure on Windows. Take a look at it, and if you don't like it, there is always the option to buy a more capable UPS...

Remember, with networked UPS management the network switch needs to be on UPS power for the management software to work when power is out... :-)

  • I just set up apcupsd on a single WIndows server with a serial connection, so I can't comment on the network connection. It may work under Windows, but make no mistake, it's a Unix program at heart. Once you get used to treating it as a unix program and have spent some time with the extensive documentation, it seems pretty easy to deal with – gillonba Jul 29 '10 at 13:19

Windows typically has good APC support built in, so you don't have to use PowerChute (at least starting with XP SP2 and SP3). If Windows is detecting your UPS under Control Panel -> Power Options (in XP), then look for an Alarms tab. If you can find this, you can figure an Alarm Action to run a program. In this case you might run PsShutdown from the sysinternals package to shutdown the remote machine when the battery level is at warning or critical.

I'm sorry, but I'm not at an XP machine with an APC UPS hooked up at the moment, so I'm not sure if these options will appear or not. I typically don't install the PowerChute software from APC on my XP (and above) clients because there's native support in Windows. (This is also why I standardized on APC)

  • I do a very similar thing with a couple of Linux servers at work that share a UPS. One of them is running apcupsd, and when the power gets low (5 mins), it runs a bash script that connects to the other with SSH (using ssh keys), and shuts it down. – Dentrasi Jan 30 '10 at 20:56
  • Windows 2008 R2 and Windows 7 do not have built in support for UPSs, you have to use the vendor supplied software again. – Chris S Apr 10 '10 at 0:53

In the long run, your best bet is two separate UPS's. More expensive, but it removes a single point of failure, and is less complicated than trying to coordinate a signaling system between the two machines (and it also reduces the load on each UPS).

  • I agree with what you say. However, given our budget I can either leave the DB server off a UPS altogether or I can hook into the dev machine's UPS. – Brian Webster Jan 31 '10 at 0:57
  • What is the load on these? Are they both for testing/development? If this is a small-scale thing, you could try virtualizing the database server on the dev machine and that would also minimize the impact on the power draw. Entirely depends on your system specs and workload as to how feasible this is though. – Bart Silverstrim Jan 31 '10 at 2:03
  • Well I could probably run both computers off of the RS1500 for nearly 10 minutes. We get a lot of lightning here so I'll get the benefit of no more resets from lightning. However, I don't want that DB server draining the entire battery if the power is out for say, 15 minutes. I agree with your points and appreciate the feedback. – Brian Webster Jan 31 '10 at 8:25

You can't with that model, not with the software it comes with anyway.

If you had a 'Smart-UPS' model from APC you could use their PowerChute Network Shutdown software to achieve this.


Make the dev machine tell the database machine to shutdown when it gets the battery alarm.

As to how to do that - I'm afraid that's beyond my knowledge.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.