APC UPS control system Power Supply User Manual


 
This final step is important if you want to ensure that your system
will automatically reboot when the power comes back on. The actual
code used on the Red Hat version is:
# See if this is a powerfail situation. # ***apcupsd***
if [ -f /etc/apcupsd/powerfail ]; then # ***apcupsd***
echo # ***apcupsd***
echo "APCUPSD will now power off the UPS" # ***apcupsd***
echo # ***apcupsd***
/etc/apcupsd/apccontrol killpower # ***apcupsd***
echo # ***apcupsd***
echo "Please ensure that the UPS has powered off before rebooting" # ***apcupsd***
echo "Otherwise, the UPS may cut the power during the reboot!!!" # ***apcupsd***
echo # ***apcupsd***
fi # ***apcupsd***
The above code must be inserted as late as possible in the halt script. On
many systems, such as Red Hat, all the disk drives were unmounted, then
remounted read-only, thus permitting access to the /etc files and the apcupsd
executable. If your system does not explicitly remount the disks, you must
remount them in read-only mode in the code that you add. Examples of code
fragments that do this can be found in the distributions/suse subdirectory
of the source.
If you are not able to insert the above code in your halt script because there
is no halt script, or because your halt script calls the init program as some
Unix systems do, you can either just forget about powering off the UPS,
which means that your machine will not automatically reboot after a power
failure, or there is yet another alternative, though not at all as satisfying as
inserting code in the halt script.
Only if you cannot insert the appropriate code in the halt script, when
you start apcupsd, normally from the /etc/rc.d/init.d/apcupsd script, use
the --kill-on-powerfail option. This will cause apcupsd to program the
UPS to shutoff the power just before it (apcupsd) does the system shutdown.
Please note that this is not the most ideal solution. Read on to understand
why.
A very important consideration is that you must set the EEPROM in your
UPS so that it waits a sufficient time for the system to halt before it shuts
off the UPS power. The current value as well as the permitted values for
your UPS can be determined by executing:
apcaccess eeprom
183