]> git.pld-linux.org Git - packages/nfs-utils.git/blobdiff - rpcidmapd.init
- use reload for idmapd
[packages/nfs-utils.git] / rpcidmapd.init
index c117b3b3c886141661ab99c66d6ec30902674818..0ab8fcea222c5f589905ba1290d0c90628ced309 100644 (file)
@@ -35,13 +35,20 @@ fi
 # /usr may be on NFS, fail silently, nfsfs will start it
 [ -x /usr/sbin/rpc.idmapd ] || exit 0
 
-RETVAL=0
+# Find out what the current runlevel dir is
+RUNLEVELDIR=$(cat /var/run/runlevel.dir)
 
-# See how we were called.
-case "$1" in
-  start)
+start() {
        # Check if the service is already running?
        if [ ! -f /var/lock/subsys/idmapd ]; then
+               # This is whacko, but we need /proc/fs/nfsd mounted before
+               # starting idmapd on NFS server
+               if [ -e "$RUNLEVELDIR/S*nfs" ]; then
+                       if ! grep -q nfsd /proc/mounts ; then
+                               modprobe -s nfsd > /dev/null 2>&1
+                               run_cmd "Mounting /proc/fs/nfsd filesystem" mount -t nfsd nfsd /proc/fs/nfsd
+                       fi
+               fi
                if ! grep -q rpc_pipefs /proc/mounts ; then
                        modprobe -s sunrpc >/dev/null 2>&1
                        run_cmd "Mounting /var/lib/nfs/rpc_pipefs filesystem" \
@@ -55,8 +62,9 @@ case "$1" in
        else
                msg_already_running "RPC idmapd"
        fi
-       ;;
-  stop)
+}
+
+stop() {
        if [ -f /var/lock/subsys/idmapd ]; then
                msg_stopping "RPC idmapd"
                killproc rpc.idmapd
@@ -64,18 +72,37 @@ case "$1" in
        else
                msg_not_running "RPC idmapd"
        fi
+}
+
+# See how we were called.
+RETVAL=0
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
        ;;
   status)
        status rpc.idmapd
        RETVAL=$?
        ;;
-  restart|reload)
-       $0 stop
-       $0 start
-       RETVAL=$?
+  restart)
+       stop
+       start
+       ;;
+  reload)
+       if [ -f /var/lock/subsys/idmapd ]; then
+               msg_reloading "RPC idmapd"
+               killproc rpc.idmapd -HUP
+               RETVAL=$?
+       else
+               msg_not_running "RPC idmapd" >&2
+               exit 7
+       fi
        ;;
   *)
-       msg_usage "$0 {start|stop|restart|status}"
+       msg_usage "$0 {start|stop|restart|reload|status}"
        exit 1
 esac
 
This page took 0.142286 seconds and 4 git commands to generate.