#! /bin/sh
#
# halt		The commands in this script are executed as the last
#		step in runlevel 0, ie halt.
#
# Version:      @(#)halt  1.9  15-Nov-1996  miquels@cistron.nl
#

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

# Kill all processes.
echo -n "Sending all processes the TERM signal... "
killall5 -15
echo "done."
sleep 5
echo -n "Sending all processes the KILL signal... "
killall5 -9
echo "done."

# Write a reboot record to /var/log/wtmp.
halt -w

# Save the random seed between reboots.
/etc/init.d/urandom stop

echo -n "Deactivating swap... "
swapoff -a
echo "done."

echo -n "Unmounting file systems... "
umount -a
echo "done."

mount -n -o remount,ro /

# See if we need to cut the power.
if [ -x /etc/init.d/ups-monitor ]
then
	/etc/init.d/ups-monitor poweroff
fi

halt -d -f
