#!/bin/sh
#
# halt		Execute the halt command.
#
# Version:      @(#)halt  2.75  19-May-1998  miquels@cistron.nl
#               modified by Holger Brueckner <darks@gentoo.org>
#               for apcupsd 28-June-2001

PATH=/sbin:/bin:/usr/sbin:/usr/bin
APCCONTROL="@sysconfdir@/apccontrol killpower" 

# See if we need to cut the power.

# See if this is a powerfail situation.
if [ -f @PWRFAILDIR@/powerfail ]; then
  echo "APCUPSD to the Rescue!"
  echo
  $APCCONTROL
  echo
  sleep 120
  exit 1
fi

/sbin/halt -nfip
