Using apcupsd to Trigger Ubuntu Shutdown from UPS
At work they just gave everyone a UPS for their office: APC BK650-AS. It comes with a cable that plugs into a USB port on your computer allowing the status of the UPS to be used to trigger a shutdown (or other actions) of your computer. Also included was a free version of the APCs PowerChute software for Windows and MAC. Supposedely there is a Linux version of PowerChute, but a quick search reveals apcupsd provides all necessary features for Linux.
Heres what I did to configure apcupsd after plugging in the cable.
- Install the software:
$ sudo apt-get install apcupsd
- Configure the daemon by editing /etc/apcupsd/apcupsd.conf:
UPSNAME SteveUPS UPSCABLE usb UPSTYPE usb # DEVICE
- Allow access on localhost by editing /etc/hosts.allow:
- You can check that the UPS is detected by looking at system messages:
$ tail /var/log/messages Aug 26 12:49:24 ginger kernel: [ 3456.772911] generic-usb 0003:051D:0002.0005: hiddev96,hidraw0: USB HID v1.10 Device [American Power Conversion Back-UPS CS 650 FW:817.v6.I USB FW:v6] on usb-0000:00:1d.0-1/input0
- Restart the daemon:
$ sudo /etc/init.d/apcupsd restart
- Check the status:
$ apcaccess status
Created on Sat, 28 Aug 2010, 4:25pm
Last changed on Fri, 16 Aug 2013, 11:17am