Currently when one of the two UPS dies, the doshutdown event is triggered, and executes the default script via apccontrol. The doshutdown script ignores the second UPS, as they are not event-connected, and proceed normally with the shutdown.
In order to have the doshutdown events somewhat connected, the two instances of apcupsd need a specifically customized configuration file. The difference will reside in the directory from which the events scripts have to be executed.
Main properties of first ups, in
And for the ups1, in
Each scriptdir should get a copy of the default scripts.
We want to customize the doshutdown script, which will not directly shutdown the machine, but has to check if the other UPS is still on, or is in shutdown mode.
At the top of the doshutdown script, we could add something like
if [ ! -f /tmp/ups1.is.down ]
if [ ! -f /tmp/ups0.is.down ]
the status 99 has a special meaning, that tells apccontrol to stop the action in progress. The five lines check if the other UPS-down-file has been created ; if no, the down-file is created for the ups being down, and exits. If yes, meaning the other UPS is down, this one is getting down as well, thus the script should continue and shutdown the machine.
/tmp/usp.is.down indicate if the ups is currently down.
Important: the init.d start script of apcupsd should remove these files, if they have been created in a previous session:
rm -f /tmp/usp.is.down
Finally, the directories created above, /etc/apcupsd/ups should be given access to the apcupsd user (or to whichever relevant user running the instances).
chown -R apcupsd /etc/apcupsd/ups
Please have a look at the detailed documentation.
edit fixed the
/tmp/ups.is.down names, the
.is was missing.