Sophie

Sophie

distrib > Mandriva > 2007.1 > x86_64 > by-pkgid > ec1353c51cf2bd4d46fb842cdb5d4cdc > files > 37

nfs-utils-1.0.12-13mdv2007.1.src.rpm

#!/bin/sh
#
# rpcidmapd     Start up and shut down RPC name to UID/GID mapper
#
# chkconfig: 345 18 68
# description: Starts user-level daemon for NFSv4 that maps user \
#              names to UID and GID numbers.
#
### BEGIN INIT INFO
# Provides: rpcidmapd
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 3 4 5
# Short-Description: RPC name to UID/GID daemon
# Description: Starts user-level daemon for NFSv4 that maps user
#              names to UID and GID numbers.
### END INIT INFO

# Source function library.
. /etc/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0

# Set defaults and read configuration
NAME=rpc.idmapd
BINARY=$NAME
LOCKFILE=/var/lock/subsys/$NAME
RPCIDMAPD_OPTIONS=
[ -f /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs

start() {
    res=0
    if [ ! -f $LOCKFILE ]; then
	echo -n "Starting $NAME:"

	# Load sunrpc which mounts the rpc_pipes fs.
	if [ -x /sbin/lsmod -a -x /sbin/modprobe ]; then
	    if ! /sbin/lsmod | grep sunrpc > /dev/null; then
		 /sbin/modprobe sunrpc || exit 1
	    fi
	fi

	# Make sure the mount worked.
	if [ -z "$RPCMTAB" ]; then
	    RPCMTAB=`awk '{ if ($3 ~ /^rpc_pipefs$/ ) print $2}' /proc/mounts`
	    if [ -z "$RPCMTAB" ]; then
		echo "Error: RPC MTAB does not exist."
		exit 1
	    fi
	fi

	# Start daemon.
	daemon $BINARY $RPCIDMAPD_OPTIONS
	res=$?
	echo
	[ $res -eq 0 ] && touch $LOCKFILE
    fi
    return $res
}

stop() {
    echo -n "Stopping $NAME: "
    killproc $BINARY
    res=$?
    echo
    [ $res -eq 0 ] && rm -f $LOCKFILE
    return $res
}

reload() {
    echo -n "Reloading $NAME: "
    killproc $BINARY -HUP
    res=$?
    echo
    return $res
}


case "$1" in
    start)
	start
	;;
    stop)
	stop
	;;
    status)
	status $BINARY
	;;
    reload)
	reload
	;;
    restart)
	stop
	start
	;;
    condrestart)
	if [ -f $LOCKFILE ]; then
	    stop
	    start
	fi
	;;
    *)
	echo "Usage: $0 {start|stop|status|reload|restart|condrestart}"
	exit 1
	;;
esac

exit $?