:
# @(#)rc1 5.3b of Jan 28, 1988
:
#	"Run Commands" for init state 0
#	Leaves the system in a state where it is safe to turn off the power
#	or go to Single-user mode.

stty sane tab3 2>/dev/null
echo '\nSystem services are now being stopped.\n'
if [ -d /etc/rc1.d ]
then
	for f in /etc/rc1.d/K*
	{
		if [ -s ${f} ]
		then
			/bin/sh ${f} stop
		fi
	}

#	system cleanup functions ONLY (things that end fast!)	

	for f in /etc/rc1.d/S*
	{
		if [ -s ${f} ]
		then
			/bin/sh ${f} start
		fi
	}
fi

trap "" 15
kill -15 -1
sleep 5
/etc/killall  9
sleep 5
sync;sync;sync
/etc/umountall
stty sane 2>/dev/null
sync;  sync
set `who -r`
case "$7" in
	0 )
		echo '\nThe system is going down.\n'
		sync
		/etc/haltsys
		;;
	* )
		echo '\nThe system is going to Single-user mode.\n'
		/etc/init s
		;;
esac
