walters / rpms / nfs-utils

Forked from rpms/nfs-utils 6 years ago
Clone
cvsdist 9e6d913
#!/bin/bash
cvsdist 9e6d913
#
cvsdist 9e6d913
# rpcsvcgssd    Start up and shut down RPCSEC GSS daemon
cvsdist 9e6d913
#
cvsdist 9e6d913
# Authors:	Chuck Lever <cel@netapp.com>
cvsdist 9e6d913
#
ae9da60
# chkconfig: 345 19 69
cvsdist 9e6d913
# description: Starts user-level daemon that manages RPCSEC GSS contexts \
cvsdist 9e6d913
#	       for the NFSv4 server.
cvsdist 9e6d913
cvsdist 9e6d913
# Source function library.
cvsdist 9e6d913
. /etc/init.d/functions
cvsdist 9e6d913
cvsdist 9e6d913
# Source networking configuration.
cvsdist 9e6d913
if [ ! -f /etc/sysconfig/network ]; then
cvsdist 9e6d913
    exit 0
cvsdist 9e6d913
fi
cvsdist 9e6d913
. /etc/sysconfig/network
cvsdist 9e6d913
cvsdist 9e6d913
# Check that networking is up.
cvsdist 9e6d913
[ "${NETWORKING}" = "no" ] && exit 0
cvsdist 9e6d913
cvsdist 9e6d913
[ ! -x /usr/sbin/rpc.svcgssd ] && exit 0
cvsdist 9e6d913
cvsdist 9e6d913
# Check for and source configuration file otherwise set defaults
cvsdist 9e6d913
[ -f /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs
cvsdist 9e6d913
[ "${SECURE_NFS}" != "yes" ] && exit 0
cvsdist 9e6d913
cvsdist 9e6d913
OPTIONS=""
cvsdist 9e6d913
RETVAL=0
cvsdist 9e6d913
prog="rpc.svcgssd"
cvsdist 9e6d913
cvsdist 9e6d913
case "$1" in
cvsdist 9e6d913
  start|condstart)
cvsdist 9e6d913
	# Make sure the daemon is not already running.
cvsdist 9e6d913
	if status $prog > /dev/null ; then
cvsdist 9e6d913
		exit 0
cvsdist 9e6d913
	fi
cvsdist 9e6d913
	rm -f /var/lock/subsys/$prog
cvsdist 9e6d913
cvsdist 9e6d913
	echo -n $"Starting NFS4 svcgssd: "
cvsdist 9e6d913
cvsdist 9e6d913
	# Load sunrpc which mounts the rpc_pipes fs.
cvsdist 9e6d913
	[ -x /sbin/lsmod -a -x /sbin/modprobe ] && {
cvsdist 9e6d913
		if ! /sbin/lsmod | grep sunrpc > /dev/null ; then
cvsdist 9e6d913
			 /sbin/modprobe sunrpc || exit 1
cvsdist 9e6d913
		fi
cvsdist 9e6d913
	}
cvsdist 9e6d913
cvsdist 9e6d913
	# Make sure the mount worked.
cvsdist 9e6d913
	[ -z "${RPCMTAB}" ] && RPCMTAB=`grep -v '^#' /proc/mounts | \
cvsdist 9e6d913
		awk '{ if ($3 ~ /^rpc_pipefs$/ ) print $2}'`
cvsdist 9e6d913
	[ -z "${RPCMTAB}" ] && {
cvsdist 9e6d913
		echo "Error: RPC MTAB does not exist."
cvsdist 9e6d913
		exit 1
cvsdist 9e6d913
	}	
cvsdist 9e6d913
cvsdist 9e6d913
	# Start daemon.
cvsdist 9e6d913
	daemon $prog ${OPTIONS}
cvsdist 9e6d913
	RETVAL=$?
cvsdist 9e6d913
	echo
cvsdist 9e6d913
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/rpc.svcgssd
cvsdist 9e6d913
	;;
cvsdist 9e6d913
  stop)
cvsdist 9e6d913
	# Stop daemon.
cvsdist 9e6d913
	echo -n $"Shutting down NFS4 svcgssd: "
cvsdist 9e6d913
	killproc $prog
cvsdist 9e6d913
	RETVAL=$?
cvsdist 9e6d913
	echo
cvsdist 9e6d913
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/rpc.svcgssd
cvsdist 9e6d913
	;;
cvsdist 9e6d913
  status)
cvsdist 9e6d913
	status rpc.svcgssd
cvsdist 9e6d913
	RETVAL=$?
cvsdist 9e6d913
	;;
cvsdist 9e6d913
  restart|reload)
cvsdist 9e6d913
	$0 stop
cvsdist 9e6d913
	$0 start
cvsdist 9e6d913
	RETVAL=$?
cvsdist 9e6d913
	;;
cvsdist 9e6d913
  condrestart)
cvsdist 9e6d913
	if [ -f /var/lock/subsys/rpc.svcgssd ]; then
cvsdist 9e6d913
		$0 restart
cvsdist 9e6d913
		RETVAL=$?
cvsdist 9e6d913
	fi
cvsdist 9e6d913
	;;
cvsdist 9e6d913
  *)
cvsdist 9e6d913
	echo $"Usage: $0 {start|stop|restart|condstart|condrestart|status}"
cvsdist 9e6d913
	exit 1
cvsdist 9e6d913
esac
cvsdist 9e6d913
cvsdist 9e6d913
exit $RETVAL