In recent times, APC has now begun to support the Linux operating system with their PowerShute software. You can either install PowerChute or use the "apcupsd" tool.
One difference that should be mentioned is that the official APC Powerchute software for Linux is NOT compatible with MS Windows clients. So, you cannot use the LAN to shutdown internal MS Windows machines.
Currently, these docs only cover the "apcupsd" tool.
- Download the newest apcupsd found in Section 5
- Install it with the command:
rpm -Uvh apcupsd-3.5.0-1.i386.rpm
- Next, fix its permissions:
chmod 750 /sbin/apcupsd
- Redhat:
- Make sure that /etc/rc.d/rc3.d/S20apcups exists
- Next, edit /etc/apcupsd.conf and make the following changes
NOTE: These configs are for a APC SmartUPS1000 on COM3
/etc/apcupsd.conf
-- CONTROL /sbin/powersc UPSCABLE smart UPSTYPE smartups UPSCLASS standalone UPSMODE disable DEVICE /dev/ttyS0 ANNOY 60 SENSITIVITY H TIMEOUT 0 BATTERYLEVEL 10 MINUTES 0 WAKEUP 60 BATTCMD /usr/local/sbin/apcupsd-battcmd TIMECMD /usr/local/sbin/apcupsd-timecmd LOADCMD /usr/local/sbin/apcupsd-loadcmd LIMITCMD /usr/local/sbin/apcupsd-limitcmd PWRCMD /usr/local/sbin/apcupsd-pwrcmd RETCMD /usr/local/sbin/apcupsd-retcmd --
- Next, we need to create the scripts to both send messages to SYSLOG for properly logging (this should be done internally but it isn't) and optionally page you.
NOTE: If you don't want to enable the paging feature, just delete those lines below.
NOTE 2: Change the pager email address to reflect both your pager ID and pager server
/usr/local/sbin/apcupsd-battcmd -- #!/bin/sh #battcmd - execute when the UPS batteries have failed" # /usr/bin/logger "APCUPSd - Battery has failed!" echo "APCUPSd - Battery has failed" | /bin/mail 1234567@skytel.com --
/usr/local/sbin/apcupsd-limitcmd -- #!/bin/sh #limitcmd - execute when MINUTES has expired" # /usr/bin/logger "APCUPSd - Minutes timeout has expired!" echo "APCUPSd - Minutes timeout has expired" | /bin/mail 1234567@skytel.com --
/usr/local/sbin/apcupsd-loadcmd -- #!/bin/sh #loadcmd - execute when UPS batteries are low" # /usr/bin/logger "APCUPSd - Battery capacity is exhausted!" echo "APCUPSd - Battery capacity is exhausted" | /bin/mail 1234567@skytel.com --
/usr/local/sbin/apcupsd-pwrcmd -- #!/bin/sh #pwrcmd - execute when the AC power has failed" # /usr/bin/logger "APCUPSd - AC power has failed!" echo "APCUPSd - AC power has failed" | /bin/mail 1234567@skytel.com --
/usr/local/sbin/apcupsd-retcmd -- #!/bin/sh #retcmd - execute when the AC power has returned" # /usr/bin/logger "APCUPSd - AC power has returned!" echo "APCUPSd - AC power has returned" | /bin/mail 1234567@skytel.com --
/usr/local/sbin/apcupsd-timecmd -- #!/bin/sh #timecmd - execute when TIMEOUT has expired" # /usr/bin/logger "APCUPSd - Timeout has expired!" echo "APCUPSd - Timeout has expired" | /bin/mail 1234567@skytel.com --
- Now, fix the permissions on the files:
chmod 700 /usr/local/sbin/apcupsd-*
- Now, lets TEST the UPS software. Connect up the UPS control cable to the UPS, plug-in the UPS to the wall outlet but DO NOT HAVE THE COMPUTER CONNECTED TO THE UPS QUITE YET.
- First, change the /etc/apcupsd.conf variable:
TIMEOUT 120
The reason to do this is to be able to test the setup quickly without draining the battery.
- Start the apcupsd process by typing in:
/sbin/powersc INIT
- Now, make sure that things are cool:
- Next, pull the plug on the UPS and wait 2 minutes. Make sure that the system shuts down ok and then powers OFF. (for SmartUPS only)
- Now, re-plug in the UPS and make sure that the system powers up ok and the file systems mount cleanly.
- If everything is ok, change the "TIMEOUT" parameter back to "0". Shut the computer down and plug it's power cord into the UPS's output.
- Power the computer back up! That's it!