3 # rpcidmapd Start up and shut down RPC name to UID/GID mapper
5 # Authors: Chuck Lever <cel@netapp.com>
8 # description: Starts user-level daemon for NFSv4 that maps user \
9 # names to UID and GID numbers.
11 # Source function library.
12 . /etc/rc.d/init.d/functions
15 . /etc/sysconfig/network
17 # Check that networking is up.
18 if is_yes "${NETWORKING}"; then
19 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
20 msg_network_down "RPC svcgssd daemon"
27 if [ -x /sbin/pidof ] && [ "$1" != "stop" ]; then
28 [ -z "`/sbin/pidof portmap`" ] && nls "Error: portmap isn't running" && exit 0
32 [ -f /etc/sysconfig/nfsfs ] && . /etc/sysconfig/nfsfs
33 [ -f /etc/sysconfig/nfsd ] && . /etc/sysconfig/nfsd
35 # /usr may be on NFS, fail silently, nfsfs will start it
36 [ -x /usr/sbin/rpc.idmapd ] || exit 0
38 # Find out what the current runlevel dir is
39 RUNLEVELDIR=$(cat /var/run/runlevel.dir)
43 # See how we were called.
46 # Check if the service is already running?
47 if [ ! -f /var/lock/subsys/idmapd ]; then
48 # This is whacko, but we need /proc/fs/nfsd mounted before
49 # starting idmapd on NFS server
50 if [ -e "$RUNLEVELDIR/S*nfs" ]; then
51 if ! grep -q nfsd /proc/mounts ; then
52 modprobe -s nfsd > /dev/null 2>&1
53 run_cmd "Mounting /proc/fs/nfsd filesystem" mount -t nfsd nfsd /proc/fs/nfsd
56 if ! grep -q rpc_pipefs /proc/mounts ; then
57 modprobe -s sunrpc >/dev/null 2>&1
58 run_cmd "Mounting /var/lib/nfs/rpc_pipefs filesystem" \
59 mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
62 msg_starting "RPC idmapd"
63 daemon rpc.idmapd $RPCIDMAPOPTIONS
65 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/idmapd
67 msg_already_running "RPC idmapd"
71 if [ -f /var/lock/subsys/idmapd ]; then
72 msg_stopping "RPC idmapd"
74 rm -f /var/lock/subsys/idmapd
76 msg_not_running "RPC idmapd"
89 if [ -f /var/lock/subsys/idmapd ]; then
90 msg_reloading "RPC idmapd"
91 killproc rpc.idmapd -HUP
94 msg_not_running "RPC idmapd" >&2
99 msg_usage "$0 {start|stop|restart|reload|status}"