Linux: Configure and Control APC SmartUPS During a Power Failure
The APC SmartUPS can be configured and controlled during a power failure on a Linux system using the apcupsd daemon and its associated utilities.
Here's how to set it up:
- Install the
apcupsdpackage:- On Debian/Ubuntu based systems:
sudo apt-get update sudo apt-get install apcupsd- On Red Hat/CentOS based systems:
sudo yum install apcupsd - Configure the
apcupsddaemon:- Edit the configuration file
/etc/apcupsd/apcupsd.confand set the values for the following parameters:UPSNAME: a name for the UPS.UPSCABLE: the cable type used to connect the UPS to the system.UPSTYPE: the type of UPS (e.g. "smart").DEVICE: the device file that represents the UPS (e.g. "/dev/ttyS0").ONBATTERYDELAY: the time in seconds to wait before shutting down the system when on battery power.
- Edit the configuration file
- Start the
apcupsddaemon:sudo systemctl start apcupsd - Check the status of the UPS:
apcaccess status - Perform a controlled shutdown of the system:
sudo apcupsd-cgi stop
apcupsd manual for more information.