Initial configuration of APC UPS in Linux from the point of view of the kettle

Having bought uninterruptible power supply from APC (namely, APC Back-UPS ES 550VA), I was surprised to find that out of the box it cannot boast of close friendship with Linux. Of course, XFCE Power Manager, which is part of XFCE 4.6, picked up and recognized the UPS, but all that it turned out to be capable of was displaying the charge level in the tray. There were no settings at all, it was impossible to even turn off the PC when a certain charge level was reached.

Turning to Google for advice, I learned about the existence of the wonderful daemon apcupsd, whose role is - never believe - managing the UPS from APC. But, as it turned out, almost all the guides on its initial setup were frankly outdated - including, oddly enough, the official manual. I had to stumble at the very beginning about "cat / proc / bus / usb / devices". Having talked with Google in a serious and confidential tone, I got him to refer to the current manual , an artistic translation of which with additions from other sources, this article is.

So, let's start by installing apcupsd itself:

sudo apt-get install apcupsd

Of course, the above is true for Debian and its derivatives, including Ubuntu. If your distribution does not use apt-get, I think you still know how to install the necessary package. Hope so.

Now we will edit the apcupsd configuration file:

sudo gedit /etc/apcupsd/apcupsd.conf

In this case, we are only interested in three parameters:

UPSCABLE - indicate the type of cable with which our UPS is connected to the PC. The comments indicate the possible types - simple, smart, ether, usb. Current home models are connected via USB - therefore, just add usb
UPSTYPE - the type of connected UPS. The comments list the possible types and the corresponding DEVICE parameter values, our choice is the usb type
DEVICE - comment out this line by putting a # in front of it - it is not needed for USB devices.

Save the changed configuration file, open the following:

sudo gedit /etc/default/apcupsd

Replace ISCONFIGURED = no with ISCONFIGURED = yes, save, close. From now on, apcupsd will know that we did not forget to configure it.

Now it’s enough to run apcupsd:
sudo /etc/init.d/apcupsd start

If it has already been started, instead of start, we, of course, will need to write restart.

That's it, your PC is now connected with the new UPS with a strong bond of friendship.

And now a little about what we can configure in the extensive /etc/apcupsd/apcupsd.conf:

ONBATTERYDELAY - the time (in seconds) that defines the delay between the detection of a power failure and the sending of the onbattery event. Default is 6
BATTERYLEVEL - battery level (in percent) at which the computer shuts off. By default - 5
MINUTES - estimated time of residual work (in minutes), upon reaching which a computer shutdown is initiated. By default - 3
TIMEOUT - the parameter is relevant for older UPSs that are unable to determine their charge level. Sets the time (in seconds) between a power failure and a computer shutdown. For a modern UPS, the parameter should be left at 0, but setting a different value may be convenient for testing the operation of the UPS. For example, if you set 30 and unplug the cord from the outlet, after half a minute apcupsd will demonstrate its ability to turn off the computer

The fulfillment of one of the conditions (BATTERYLEVEL, MINUTES or TIMEOUT) is enough to turn off the computer. A finer setting is not described, because its need for a home user is very doubtful.

For a long time the fairy tale affects, but not for long the thing is done: I think the user will perform the described actions in a couple of minutes. I hope this article helps someone to make friends with their APC Linux UPSs, saving time and not getting stuck in outdated manuals.

Also popular now: