Listing 1. sbin/init.d/halt.local
# Added automatically by apcupsd installation
# XXX APCUPSD - DO NOT EDIT XXX
if [ -f /etc/apcupsd/powerfail ]; then
# XXX APCUPSD - DO NOT EDIT XXX
echo "Power down detected while shutting down."
# XXX APCUPSD - DO NOT EDIT XXX
echo "Sending all processes the TERM signal..."
# XXX APCUPSD - DO NOT EDIT XXX
killall5 -15
# XXX APCUPSD - DO NOT EDIT XXX
# Do a fast kill
# XXX APCUPSD - DO NOT EDIT XXX
sleep 1
# XXX APCUPSD - DO NOT EDIT XXX
echo "Sending all processes the KILL signal..."
# XXX APCUPSD - DO NOT EDIT XXX
killall5 -9
# XXX APCUPSD - DO NOT EDIT XXX
echo "Remounting filesystems read-only."
# XXX APCUPSD - DO NOT EDIT XXX
mounts=/etc/fstab
# XXX APCUPSD - DO NOT EDIT XXX
test -r /proc/mounts && mounts=/proc/mounts
# XXX APCUPSD - DO NOT EDIT XXX
while read des fs rest; do
# XXX APCUPSD - DO NOT EDIT XXX
mount -v -n -o remount,ro $fs
# XXX APCUPSD - DO NOT EDIT XXX
done < $mounts
# XXX APCUPSD - DO NOT EDIT XXX
echo "Preparing UPS to power shutdown."
# XXX APCUPSD - DO NOT EDIT XXX
/etc/apcupsd/apccontrol killpower
# XXX APCUPSD - DO NOT EDIT XXX
fi
# XXX APCUPSD - DO NOT EDIT XXX