Tryag File Manager
Home
-
Turbo Force
Current Path :
/
etc
/
init.d
/
Upload File :
New :
File
Dir
//etc/init.d/rpcidmapd
#!/bin/bash # # rpcidmapd Start up and shut down RPC name to UID/GID mapper # # Authors: Chuck Lever <cel@netapp.com> # # chkconfig: 345 18 85 # 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. [ -f /etc/sysconfig/network ] && . /etc/sysconfig/network # Check for and source configuration file otherwise set defaults [ -f /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs RETVAL=0 uid=`id | cut -d\( -f1 | cut -d= -f2` prog="rpc.idmapd" LOCKFILE=/var/lock/subsys/$prog case "$1" in start|condstart) # Check that networking is up. [ "${NETWORKING}" != "yes" ] && exit 6 [ ! -x /usr/sbin/rpc.idmapd ] && exit 5 # Only root can start the service [ $uid -ne 0 ] && exit 4 # Make sure the daemon is not already running. [ "$1" = "condstart" -a -n "`pidofproc $prog`" ] && { killproc $prog "-SIGHUP" > /dev/null exit 0 } [ "$1" = "start" ] && { if status $prog > /dev/null ; then exit 0 fi } rm -f $LOCKFILE echo -n $"Starting RPC idmapd: " # Make sure the rpc_pipefs filesystem is available [ "${RPCMTAB}" != "noload" ] && { RPCMTAB=`grep -v '^#' /proc/mounts | \ awk '{ if ($3 ~ /^rpc_pipefs$/ ) print $2}'` [ -z "${RPCMTAB}" ] && { [ -x /sbin/lsmod -a -x /sbin/modprobe ] && { if ! /sbin/lsmod | grep sunrpc > /dev/null ; then /sbin/modprobe sunrpc fi } RPCMTAB=`grep -v '^#' /proc/mounts | \ awk '{ if ($3 ~ /^rpc_pipefs$/ ) print $2}'` [ -z "${RPCMTAB}" ] && { \ echo "Error: RPC MTAB does not exist." exit 6 } } } # Start daemon. daemon $prog ${RPCIDMAPDARGS} RETVAL=$? echo [ $RETVAL -eq 0 ] && touch $LOCKFILE ;; stop) # Only root can stop the service [ $uid -ne 0 ] && exit 4 # Stop daemon. echo -n $"Stopping RPC idmapd: " killproc $prog RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f $LOCKFILE ;; status) status $prog RETVAL=$? ;; restart|reload|force-reload) # Only stop the daemon if its running [ -n "`pidofproc $prog`" ] && { $0 stop } $0 start RETVAL=$? ;; condrestart|try-restart) if [ -f $LOCKFILE ]; then $0 restart RETVAL=$? fi ;; condstop) if [ -f $LOCKFILE ]; then $0 stop RETVAL=$? fi ;; *) echo $"Usage: $0 {start|stop|restart|force-reload|condstart|condrestart|try-restart|status|condstop}" RETVAL=2 ;; esac exit $RETVAL