]> git.pld-linux.org Git - packages/nfs-utils.git/blobdiff - nfslock.init
- move blkmapd, idmapd, statd and gssd to /sbin which allows us to remove
[packages/nfs-utils.git] / nfslock.init
index 609cb8939e5a39f188dcccd67ee69c65851b956f..1ece3ccaaadc50f51515f6eeeeccba5f60dcd9ad 100644 (file)
@@ -30,54 +30,50 @@ 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
 
-# /usr may be on NFS, fail silently, nfsfs will start it
-[ -x /usr/sbin/rpc.statd ] || exit 0
-
 start() {
        # Check if the service is already running?
-       if [ ! -f /var/lock/subsys/nfslock ]; then
-               # Set the ports lockd should listen on
-               if [ -n "$LOCKD_TCPPORT" ]; then
-                       /sbin/sysctl -w fs.nfs.nlm_tcpport=$LOCKD_TCPPORT >/dev/null 2>&1
-               fi
-               if [ -n "$LOCKD_UDPPORT" ]; then
-                       /sbin/sysctl -w fs.nfs.nlm_udpport=$LOCKD_UDPPORT >/dev/null 2>&1
-               fi
-
-               [ -n "$STATD_PORT" ] && STATDOPTS="$STATDOPTS -p $STATD_PORT"
-               [ -n "$STATD_OUTPORT" ] && STATDOPTS="$STATDOPTS -o $STATD_OUTPORT"
-
-               # Start daemons.
-               # Don't put sm-notify here, statd will run it when started
-               msg_starting "RPC statd"
-               daemon rpc.statd $STATDOPTS
-               RETVAL=$?
-               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nfslock
-       else
+       if [ -f /var/lock/subsys/nfslock ]; then
                msg_already_running "RPC statd"
+               return
        fi
+
+       # Set the ports lockd should listen on
+       if [ -n "$LOCKD_TCPPORT" ]; then
+               /sbin/sysctl -w fs.nfs.nlm_tcpport=$LOCKD_TCPPORT >/dev/null 2>&1
+       fi
+       if [ -n "$LOCKD_UDPPORT" ]; then
+               /sbin/sysctl -w fs.nfs.nlm_udpport=$LOCKD_UDPPORT >/dev/null 2>&1
+       fi
+
+       # Start daemons.
+       # Don't put sm-notify here, statd will run it when started
+       msg_starting "RPC statd"
+       daemon /sbin/rpc.statd $STATDOPTIONS
+       RETVAL=$?
+       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nfslock
 }
 
 stop() {
-       if [ -f /var/lock/subsys/nfslock ]; then
-               # Reset the lockd ports if they were set
-               if [ -n "$LOCKD_TCPPORT" ]; then
-                       /sbin/sysctl -w fs.nfs.nlm_tcpport=0 >/dev/null 2>&1
-               fi
-               if [ -n "$LOCKD_UDPPORT" ]; then
-                       /sbin/sysctl -w fs.nfs.nlm_udpport=0 >/dev/null 2>&1
-               fi
-               # Stop daemons.
-               msg_stopping "RPC statd"
-               killproc rpc.statd
-               rm -f /var/lock/subsys/nfslock
-       else
+       if [ ! -f /var/lock/subsys/nfslock ]; then
                msg_not_running "RPC statd"
+               return
        fi
+
+       # Reset the lockd ports if they were set
+       if [ -n "$LOCKD_TCPPORT" ]; then
+               /sbin/sysctl -w fs.nfs.nlm_tcpport=0 >/dev/null 2>&1
+       fi
+       if [ -n "$LOCKD_UDPPORT" ]; then
+               /sbin/sysctl -w fs.nfs.nlm_udpport=0 >/dev/null 2>&1
+       fi
+       # Stop daemons.
+       msg_stopping "RPC statd"
+       killproc rpc.statd
+       rm -f /var/lock/subsys/nfslock
 }
 
 RETVAL=0
@@ -89,10 +85,6 @@ case "$1" in
   stop)
        stop
        ;;
-  status)
-       status rpc.statd
-       exit $?
-       ;;
   restart|force-reload)
        stop
        start
@@ -108,6 +100,10 @@ case "$1" in
                exit 0
        fi
        ;;
+  status)
+       status rpc.statd
+       exit $?
+       ;;
   *)
        msg_usage "$0 {start|stop|restart|force-reload|probe|status}"
        exit 3
This page took 0.082127 seconds and 4 git commands to generate.