]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - etc/redhat/rpcidmapd.init
Prepare to support gss authentication and idmap looks for nfsv4
[nfs-utils.git] / etc / redhat / rpcidmapd.init
diff --git a/etc/redhat/rpcidmapd.init b/etc/redhat/rpcidmapd.init
new file mode 100644 (file)
index 0000000..63ee08c
--- /dev/null
@@ -0,0 +1,70 @@
+#!/bin/bash
+#
+# rpcidmapd     Start up and shut down RPC name to UID/GID mapper
+#
+# Authors:     Chuck Lever <cel@netapp.com>
+#
+# chkconfig: 0356 19 69
+# description: Starts user-level daemon for NFSv4 that maps user \
+#              names to UID and GID numbers.
+
+# Source function library.
+. /etc/init.d/functions
+
+# Source networking configuration.
+if [ ! -f /etc/sysconfig/network ]; then
+    exit 0
+fi
+. /etc/sysconfig/network
+
+# Check that networking is up.
+[ "${NETWORKING}" = "no" ] && exit 0
+
+[ ! -x /usr/sbin/rpc.idmapd ] && exit 0
+
+OPTIONS=""
+RETVAL=0
+prog="rpc.idmapd"
+
+case "$1" in
+  start)
+       # make sure the rpc pipe fs is mounted already
+       RPCMTAB=`grep -v '^#' /proc/mounts | awk '{ if ($3 ~ /^rpc_pipefs$/ ) print $2}'`
+       if [ -n "$RPCMTAB" ]; then
+               # Start daemon.
+               echo -n $"Starting $prog: "
+               daemon /usr/sbin/rpc.idmapd ${OPTIONS} -p ${RPCMTAB}/nfs
+               RETVAL=$?
+               echo
+               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/rpc.idmapd
+       fi
+       ;;
+  stop)
+       # Stop daemon.
+       echo -n $"Shutting down $prog: "
+       killproc $prog
+       RETVAL=$?
+       echo
+       [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/rpc.idmapd
+       ;;
+  status)
+       status rpc.idmapd
+       RETVAL=$?
+       ;;
+  restart|reload)
+       $0 stop
+       $0 start
+       RETVAL=$?
+       ;;
+  condrestart)
+       if [ -f /var/lock/subsys/rpc.idmapd ]; then
+               $0 restart
+               RETVAL=$?
+       fi
+       ;;
+  *)
+       echo $"Usage: $0 {start|stop|restart|condrestart|status}"
+       exit 1
+esac
+
+exit $RETVAL