mcinglis / rpms / nfs-utils

Forked from rpms/nfs-utils 2 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
#
3f418c2
# chkconfig: - 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
3f418c2
# List of kernel modules to load
3f418c2
[ -z "${SECURE_NFS_MODS}" ] && SECURE_NFS_MODS="des rpcsec_gss_krb5"
3f418c2
cvsdist 9e6d913
OPTIONS=""
cvsdist 9e6d913
RETVAL=0
ba86d89
LOCKFILE=/var/lock/subsys/rpcsvcgssd
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
ba86d89
	rm -f $LOCKFILE
cvsdist 9e6d913
3f418c2
	echo -n $"Starting RPC 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
3f418c2
		# Load rpcsec modules
3f418c2
		for i in ${SECURE_NFS_MODS}
3f418c2
		do 
3f418c2
			if ! /sbin/lsmod | grep $i > /dev/null ;  then
3f418c2
				 /sbin/modprobe $i || exit 1
3f418c2
			fi
3f418c2
		done
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
ba86d89
	[ $RETVAL -eq 0 ] && touch $LOCKFILE
cvsdist 9e6d913
	;;
cvsdist 9e6d913
  stop)
cvsdist 9e6d913
	# Stop daemon.
3f418c2
	echo -n $"Shutting down RPC svcgssd: "
cvsdist 9e6d913
	killproc $prog
cvsdist 9e6d913
	RETVAL=$?
cvsdist 9e6d913
	echo
ba86d89
	[ $RETVAL -eq 0 ] && rm -f $LOCKFILE
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)
ba86d89
	if [ -f $LOCKFILE ]; then
cvsdist 9e6d913
		$0 restart
cvsdist 9e6d913
		RETVAL=$?
cvsdist 9e6d913
	fi
cvsdist 9e6d913
	;;
ab5220e
  condstop)
ab5220e
	if [ -f $LOCKFILE ]; then
ab5220e
		$0 stop
ab5220e
		RETVAL=$?
ab5220e
	fi
ab5220e
	;;
cvsdist 9e6d913
  *)
ab5220e
	echo $"Usage: $0 {start|stop|restart|condstart|condrestart|condstop|status}"
cvsdist 9e6d913
	exit 1
cvsdist 9e6d913
esac
cvsdist 9e6d913
cvsdist 9e6d913
exit $RETVAL