#!/bin/sh
#
# Copyright (c) 1991, by Sun Microsystems, Inc.
#
#

if [ ! -d /usr/bin ]
then			# /usr not mounted
	exit
fi

killproc() {		# kill the named process(es)
	pid=`/usr/bin/ps -e |
	     /usr/bin/grep $1 |
	     /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`
	[ "$pid" != "" ] && kill -HUP $pid
}


# Start/stop PC-NFS daemons

case "$1" in
'start')

	#
	# start pcnfs authentication server and print services
	#
	if [ -f /usr/lib/nfs/rpc.pcnfsd ] ; then
		echo "Starting PC-NFS authentication server and print services."
		/usr/lib/nfs/rpc.pcnfsd &
	fi

	#
	# start pcnfs authentication server and print services
	#
	if [ -f /usr/lib/nfs/msgserv ] ; then
		echo "Starting console messaging server."
		/usr/lib/nfs/msgserv &
	fi

	#
	# FOR DIALUP SLIP USE ONLY!
	# clean up slip user table in case we crashed while connected
	#
	if [ -f /etc/slip.config -a -f /etc/mkslipuser ] ; then
		echo "Resetting SLIP user table."
		/etc/mkslipuser 
	fi
	;;

'stop')
	echo "Stopping PC-NFS authenitication server and print services."
	killproc rpc.pcnfsd
	echo "Stopping PC-NFS console messaging server."
	killproc msgserv
	echo "Stopping PC-NFS slip daemon."
	killproc slattach
	;;
*)
	echo "Usage: /etc/init.d/pcnfs { start | stop }"
	;;
esac
exit 0
