#!/sbin/sh
#
# Copyright (c) 1997-1998 by Sun Microsystems, Inc.
# All rights reserved.
#
#ident	"@(#)utmpd	1.6	98/04/19 SMI"

case "$1" in
'start')
	[ ! -x /usr/lib/utmpd ] && exit 0

	# If a utmppipe exists, check for a utmpd process and exit
	# if the daemon is already running.

	if [ -p /etc/utmppipe ]; then
		if /usr/bin/pgrep -x -u 0 -P 1 utmpd >/dev/null 2>&1; then
			echo "$0: utmpd is already running"
			exit 0
		fi
	fi

	/usr/bin/rm -f /etc/utmppipe
	/usr/lib/utmpd &
	;;

'stop')
	/usr/bin/pkill -x -u 0 -P 1 utmpd
	;;

*)
	echo "Usage: $0 { start | stop }"
	exit 1
	;;
esac
exit 0
