]> git.pld-linux.org Git - packages/nfs-utils.git/blobdiff - rpcidmapd.init
- never use '<=' in trigger comparision; rel 3
[packages/nfs-utils.git] / rpcidmapd.init
index 69659b003737d0ac4d94fadb297a342b9f454bae..f10ae439bc46883285a0c518bff1df0d0b5996e5 100644 (file)
@@ -1,12 +1,10 @@
-#!/bin/bash
+#!/bin/sh
 #
-# rpcidmapd     Start up and shut down RPC name to UID/GID mapper
+# idmapd       Start up and shut down RPC name to UID/GID mapper
 #
-# Authors:     Chuck Lever <cel@netapp.com>
-#
-# chkconfig: 345 13 82
-# description: Starts user-level daemon for NFSv4 that maps user \
-#              names to UID and GID numbers.
+# chkconfig:   345 12 83
+# description: Starts user-level daemon for NFSv4 that maps user \
+#              names to UID and GID numbers.
 
 # Source function library.
 . /etc/rc.d/init.d/functions
 # Check that networking is up.
 if is_yes "${NETWORKING}"; then
        if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
-               msg_network_down "RPC svcgssd daemon"
+               msg_network_down "RPC idmapd"
                exit 1
        fi
 else
        exit 0
 fi
 
-if [ -x /sbin/pidof ] && [ "$1" != "stop" ]; then
-       [ -z "`/sbin/pidof portmap`" ] && nls "Error: portmap isn't running" && exit 0
+if [ "$1" != "stop" ]; then
+       check_portmapper || { nls "Error: portmap isn't running" && exit 0; }
 fi
 
 # Get service config
@@ -38,23 +36,19 @@ fi
 # Find out what the current runlevel dir is
 RUNLEVELDIR=$(cat /var/run/runlevel.dir)
 
-RETVAL=0
-
-# 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 [ -e "$RUNLEVELDIR"/S*nfs ]; then
                        if ! grep -q nfsd /proc/mounts ; then
-                               modprobe -s nfsd > /dev/null 2>&1
+                               modprobe 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
+                       modprobe sunrpc >/dev/null 2>&1
                        run_cmd "Mounting /var/lib/nfs/rpc_pipefs filesystem" \
                                mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
                fi
@@ -66,8 +60,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
@@ -75,18 +70,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.047603 seconds and 4 git commands to generate.