:
#  @(#)singleuser 5.3b of Jan 28, 1988
:
#
# If any argument prompt user
#
ASK=false
if [ $# = 0 ]
then
	ASK=true
fi
#
# First check if we are already Single-User
#
set `who -r`
if [ $7 = "S" ]
then
	echo "\nThe system is already in System Maintenance Mode."
	exit 1
fi
#
if [ "$ASK" = "true" ]
then
	echo "\nYou will kill all currently running processes."
	echo "Do you wish to continue? (y/n) \c"
	read answer
	case $answer in
		[yY]*)	echo "\nKilling all processes..." ;;
		*)	echo "singleuser: aborted."
			exit 1 ;;
	esac
fi
echo  "\nEntering System Maintenance Mode...\n"
/etc/init 1
sleep 30	# so user won't get another prompt before init changes state
