#! /sbin/sh
#Tag 0x00000f00

# GRIO control
# "$Revision: 1.3 $"

CONFIG=/etc/config

case $1 in
'start')
	set `who -r`
	if [ $9 = "S" ]
	then
		#
		# Terminate any running ggds. 
		#
		killall ggd

		#
		# Remove lock file
		#
		if [ -f /tmp/grio.lock ] ; then
			rm /tmp/grio.lock
		fi

		#
		# Start the label daemon if the configuation 
		# file exists.
		#
		if [ -f /etc/grio_config ] ; then
			/usr/sbin/ggd `cat $CONFIG/ggd.options 2> /dev/null` &
		fi

	fi
	;;

'stop')
	#
	# Shutdown the ggd daemon.
	#
	if /sbin/chkconfig verbose ; then
		echo "Shutting down GGD:"
	fi

	# Stop the label daemon
	killall ggd
	;;

*)
	echo "usage: /etc/init.d/grio {start|stop}"
	;;
esac
