#!/sbin/sh
# @(#) $Revision: 72.2 $
#
# NOTE:	This script is not configurable!  Any changes made to this
# 	script will be overwritten when you upgrade to the next
#	release of HP-UX.
#
# This script is run when the powerfail entry is executed from /etc/inittab.
# Powerfail handling is controlled by three scripts:
#	/sbin/powerfail		HP-supplied execution script, not to be modified
#	/etc/powerfail.cfg	user-modifiable configuration values
#	/etc/local/powerfail	user-modifiable execution script
# 

echo "POWER FAIL \c"

# read powerfail configuration variables
if [ -r /etc/powerfail.cfg ]
then 
	. /etc/powerfail.cfg
fi

date

# execute any user-supplied commands
if [ -x "$USER_CMDS" ]
then
	. "$USER_CMDS"
fi

echo "Check to make sure all systems still on line"
/sbin/dasetup < /dev/console > /dev/console 2>&1	# download IO cards
if [ "$PFAIL_REPORT" -eq 1  -a -x /usr/bin/nohup -a -x /usr/sbin/wall ]
then
	echo "   *** POWER FAIL ***" | /usr/bin/nohup /usr/sbin/wall > /dev/null 2>&1 &
fi
uname
if [ $PFAIL_LOG -eq 1 ]			# assume log file is on an on-line disk
then
	date >> $PFAIL_LOGFILE
fi

echo "POWER FAIL FINISHED"
