#! /bin/sh
# Copyright (c) 1996-2002 SuSE Linux AG, Nuernberg, Germany.
# All rights reserved.
#
# Author: Florian La Roche, 1996
#	  Werner Fink <werner@suse.de>, 1996,98,2000
#	  Burchard Steinbild, 1996
#
# Please send feedback to http://www.suse.de/feedback
#
# /etc/init.d/single
#

. /etc/rc.status

#
# Avoid being interrupted by child or keyboard
#
trap "echo" SIGINT SIGSEGV SIGQUIT SIGTERM
set +e

rc_reset
case "$1" in
    start)
	if test -n "$KBD_RATE" -a -n "$KBD_DELAY" -a -x /sbin/kbdrate; then
	    echo Setting keyboard repeat rate and delay time
	    /sbin/kbdrate -r $KBD_RATE -d $KBD_DELAY
	    rc_status -v1
	fi
	echo "Sending all processes the TERM signal..."
	killall5 -15
	echo -e "$rc_done_up"
	sleep 3
	echo "Sending all processes the KILL signal..."
	killall5 -9
	echo -e "$rc_done_up"
	#
	# If we're not in single user mode we should go down there.
	#
	if test -n "$RUNLEVEL" -a "$RUNLEVEL" != "S" ; then
	    exec init S
	fi
	;;
    stop)
	case `uname -r` in
            0.*|1.*|2.[01].*|2.2.?|2.2.10)
		echo -n "Running update (bdflush) daemon"
		/sbin/update
		rc_status -v1
		;;
	esac
	;;
    *)
	echo "Usage: $0 {start|stop}"
	exit 1
esac
rc_exit
