]> git.pld-linux.org Git - packages/nfs-utils.git/blobdiff - rquotad.init
- proper use of shell variables and wildcards
[packages/nfs-utils.git] / rquotad.init
index c2e1f4b20ecf2b54dd8e7f394a86fcd01211e9ec..6956e71938b6037ad3dc88d46e566332b944d180 100644 (file)
@@ -1,9 +1,9 @@
 #!/bin/sh
 #
-# rquotad       This shell script takes care of starting and stopping
-#               the NFS quota service.
+# rquotad      This shell script takes care of starting and stopping
+#              the NFS quota service.
 #
-# chkconfig:   345 62 18
+# chkconfig:   345 12 82
 # description: NFS is a popular protocol for file sharing across \
 #              TCP/IP networks. This service provides NFS file \
 #              locking functionality.
 [ -f /etc/sysconfig/rquotad ] && . /etc/sysconfig/rquotad
 
 # Check that networking is up.
-if is_no "${NETWORKING}"; then
-       msg_network_down "NFS rquotad"
-       exit 1
+if is_yes "${NETWORKING}"; then
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+               msg_network_down "NFS rquotad"
+               exit 1
+       fi
+else
+       exit 0
 fi
 
-if [ -x /sbin/pidof ] && [ "$1" != "stop" ]; then
-       [ -z "`/sbin/pidof portmap`" ] && echo "Error: portmap isn't running" && exit 0
+if [ -x /sbin/pidof ] && [ "$1" != "stop" ] && [ -z "`/sbin/pidof portmap`" ]; then
+       echo "Error: portmap isn't running"
+       exit 0
 fi
 
-# Sanity checks
-[ -x /usr/sbin/rpc.rquotad ] || exit 0
-
-# See how we were called.
-case "$1" in
-  start)
+start() {
        # Check if the service is already running?
        if [ ! -f /var/lock/subsys/rquotad ]; then
+               # RQUOTADOPTIONS will be removed in the future
+               OPTIONS="$RQUOTADOPTIONS"
+               [ -n "$RQUOTAD_PORT" ] && OPTIONS="$OPTIONS -p $RQUOTAD_PORT"
+               is_yes "$AUTOFS" && OPTIONS="$OPTIONS --autofs"
+               if is_yes "$REMOTE_QUOTA_SETTING"; then
+                   OPTIONS="$OPTIONS --setquota"
+               else
+                   OPTIONS="$OPTIONS --no-setquota"
+               fi
                # Start daemons.
                msg_starting "NFS quotas"
-               daemon rpc.rquotad
-               touch /var/lock/subsys/rquotad
+               daemon rpc.rquotad $OPTIONS
+               RETVAL=$?
+               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/rquotad
        else
                msg_already_running "NFS quota daemon"
-               exit 1
        fi
-       ;;
-  stop)
-       if [ -f /var/lock/subsys/rquotad ]; then
+}
+
+stop() {
+       if [ -f /var/lock/subsys/rquotad ]; then
                # Stop daemons.
                msg_stopping "NFS quotas"
                killproc rpc.rquotad
                rm -f /var/lock/subsys/rquotad
        else
                msg_not_running "NFS quota daemon"
-               exit 1
        fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
        ;;
   status)
        status rpc.rquotad
+       exit $?
        ;;
-  restart)
-       $0 stop
-       $0 start
+  restart|force-reload)
+       stop
+       start
        ;;
   probe)
-       if [ ! -f /var/lock/subsys/quotad ] ; then
-         echo start; exit 0
+       if [ ! -f /var/lock/subsys/quotad ]; then
+               echo start; exit 0
        fi
-       /sbin/pidof rpc.rquotad >/dev/null 2>&1;
-       if [ $? = 1 ] ; then
-         echo restart; exit 0
+       /sbin/pidof rpc.rquotad >/dev/null 2>&1
+       if [ $? = 1 ]; then
+               echo restart; exit 0
        fi
        ;;
   *)
-       msg_usage "$0 {start|stop|status|restart|probe}"
-       exit 1
+       msg_usage "$0 {start|stop|restart|force-reload|probe|status}"
+       exit 3
 esac
 
-exit 0
+exit $RETVAL
This page took 0.03837 seconds and 4 git commands to generate.