#! /bin/sh
#
# halt		Execute the halt command.
#
# Version:      @(#)halt  2.85-22  19-Jun-2004  miquels@cistron.nl
#
# chkconfig: 0 90 0
#

PATH=/sbin:/bin:/usr/sbin:/usr/bin

# Get the default from /etc/default/halt.
[ -f /etc/default/halt ] && . /etc/default/halt

if [ "$INIT_HALT" = "" ]
then
	case "$HALT" in
		[Pp]*)
			INIT_HALT=POWEROFF
			;;
		[Hh]*)
			INIT_HALT=HALT
			;;
		*)
			INIT_HALT=POWEROFF
			;;
	esac
fi

# See if we need to cut the power.
if [ "$INIT_HALT" = "POWEROFF" ] && [ -x /etc/init.d/ups-monitor ]
then
	/etc/init.d/ups-monitor poweroff
fi

# Don't shut down drives if we're using RAID.
hddown="-h"
if grep -qs '^md.*active' /proc/mdstat
then
	hddown=""
fi

# If INIT_HALT=HALT don't poweroff.
poweroff="-p"
if [ "$INIT_HALT" = "HALT" ]
then
	poweroff=""
fi

#halt -d -f -n -i $poweroff $hddown

echo halt 1
/bin/fp_control -e
echo halt 2
/bin/fp_control -e
echo halt 3
/bin/fp_control -e
echo halt 4
/bin/fp_control -e
echo halt 5
/bin/fp_control -e
echo halt 6
/bin/fp_control -e
echo halt 7
/bin/fp_control -e
echo halt 8
/bin/fp_control -e
echo halt 9
/bin/fp_control -e
echo halt 10
/bin/fp_control -e
echo halt 11
/bin/fp_control -e
echo halt 12
/bin/fp_control -e
echo halt 13
/bin/fp_control -e
echo halt 14
/bin/fp_control -e
echo halt 15
/bin/fp_control -e
echo halt 16
/bin/fp_control -e
echo halt 17
/bin/fp_control -e
echo halt 18
/bin/fp_control -e
echo halt 19
/bin/fp_control -e
echo halt 20
/bin/fp_control -e
echo halt 21
/bin/fp_control -e
echo halt 22
/bin/fp_control -e
echo halt 23
/bin/fp_control -e
echo halt 24
/bin/fp_control -e
echo halt 25
/bin/fp_control -e
echo halt 26

: exit 0
