Friday, January 16, 2009

Safe Shutdown of Ubuntu 8.04 with APC UPS (USB)

Intro
I recently installed Ubuntu 8.04 LTS server on a nice PowerEdge T300 server from Dell. I am also using APC UPS, model Back-UPS XS 1300 LCD with it. Ubuntu's power monitor does correctly reprots the battery charge, but is not shutting down the system when the battery charge is low/critically low. In order to do that I needed to install a nice utility called apcupsd.

Setup
Install the apcupsd package
sudo apt-get install apcupsd

Edit file /etc/default/apcupsd
sudo gedit /etc/default/apcupsd

and change the following line to "yes"
Set ISCONFIGURED=yes

Now edit the configuration file
sudo gedit /etc/apcupsd/apcupsd.conf

Make sure that the following is set:
UPSCABLE usb
UPSTYPE usb
DEVICE

NETSERVER on
NISPORT 3551

You can also adjust these values to what you think fits:
BATTERYLEVEL 8
MINUTES 4

Verify Setup
To start the apcupsd service use following command:
sudo apcupsd start

Status can be checked with the following command:
sudo apcaccess status

Restart PC and makes sure that apcupsd is running by checking the status with the same command.

Final test
Unplug the UPS and monitor the status of the battery. When it comes down to the preset values (in my case 8% or 4 minutes left) your system should initiate and complete shutdown process before your battery runs out.

Reference
http://www.apcupsd.org

3 comments:

Claudio said...

Thanks for this information!! it helped me out to configure my APC CS 500, with Ubuntu 8.04 64 bits.

Unknown said...

Thanks helped get my APC-350UC working in about 5 mins once installed!

Unknown said...

Absolutely fantastic guide. Thanks so much - I feel safe now!