by August 9, 2003 0 comments

If you run a Linux system and have an APC UPS, then you can use software to control the UPS, for example, to do an unattended system shutdown if there’s a power failure. A UPS is connected to the computer via serial or USB cables, and the control software is called Apcupsd (APC UPS daemon). We used an APC Back-UPS connected to a machine running
PCQLinux 8.0. 

Mount this month’s PCQEssential CD and install the RPM apcupsd-3.8.6-1_rh8.i386.rpm from the system\cdrom\linux directory using the following command.

rpm -ivh apcupsd-3.8.6-1_rh8.i386.rpm 

Apcupsd on the Network
Apcupsd can also be used to monitor several UPSs connected to different machines as well as when a single UPS powers many machines. You can also set it up to check the UPS’s status across the network using a browser. More information at

Before starting Apcupsd, you must determine the type of cable connecting the UPS and the computer, the UPS model and the device file name for the serial port to which the UPS cable is connected. To find out the type of cable, look at the plastic serial connector and note down the number printed on it. In our case, it was 940-0020C, and the serial cable of the UPS was connected to COM1. Accordingly, modify the values for UPSCABLE, UPSTYPE and DEVICE in the file named apcupsd.conf found in /etc/apcupsd directory. In our case, the values were as follows:

UPSCABLE 940-0020C
UPSTYPE backups 
DEVICE /dev/ttyS0

Note that the DEVICE is set to /dev/ttyS0. If your UPS is connected to COM2, the value for DEVICE would be /dev/ttyS1. You can refer to the URL to get the UPSTYPE and possible UPSCABEL values for different models. 
Next, scroll down to the section ‘Configuration parameters used during power failure’ and modify the line that says ‘Timeout 0’ to ‘Timeout 600’. This line indicates that the machine will start shutting down 600 secs (10 mins) after a power failure. This value will vary depending upon how much backup your UPS provides. 

Note that the timeout value is required by our UPS model that is capable of only simple signaling (transmits only limited data about the UPS). If you have an APC UPS with smart signaling (you can find this out in the accompanying manual), you can configure Apcupsd to shutdown when the battery level reaches a percentage or when the battery is left with a specified runtime. Next, scroll to the line that says


and change it to 


Here, the UPS name is LINUXUPS. You can substitute this.

Now start the APC UPS Daemon by issuing the following command.

/etc/rc.d/init.d/apcupsd start

A quick method to check whether things are working is to shutdown the main supply to the UPS. You should immediately get a message at the Linux console, which looks as follows.

Warning power loss detected with UPS LINUXUPS
Power failure on UPS LINUXUPS. Running on batteries.

If you don’t see the above message, then ensure that you’ve given the correct UPS model, cable type and DEVICE to which the UPS is connected. You may like to tweak through the section ‘Configuration parameters used during power failure’ of the configuration file apcupsd. conf. You can set up a time to flash warning messages (at specified intervals) to the logged in users to inform about the power failure. You can also disable further logins altogether, after a power failure. It is easy to set this all, once you parse through the well-documented

Shekhar Govindarajan

No Comments so far

Jump into a conversation

No Comments Yet!

You can be the one to start a conversation.

Your data will be safe!Your e-mail address will not be published. Also other data will not be shared with third person.