eventscripts: New configuration variable CTDB_NFS_STARTSTOP_WRAPPER 1.2.40-junkcode
authorMartin Schwenke <martin@meltin.net>
Fri, 4 Jan 2013 04:40:16 +0000 (15:40 +1100)
committerMartin Schwenke <martin@meltin.net>
Sat, 25 May 2013 23:00:22 +0000 (09:00 +1000)
Some users need to wrap NFS start/stop/restart operations to change
the behaviour of certain NFS operations.  Setting
CTDB_NFS_STARTSTOP_WRAPPER to the desired wrapper enables this.

Signed-off-by: Martin Schwenke <martin@meltin.net>
config/ctdb.sysconfig
config/functions

index 08a550f4c071a2996368a3f9d871b4ba178b1d15..45bc4b7084a2e4b57609d4011f1ababaaa2a14ef 100644 (file)
@@ -302,6 +302,10 @@ CTDB_SERVICE_AUTOSTARTSTOP=yes
 # above 90%
 # CTDB_CHECK_FS_USE="/:90 /var:90"
 
+# When the NFS eventscript starts/stop/restarts NFS, wrap those
+# operations as specified.
+# CTDB_NFS_STARTSTOP_WRAPPER=""
+
 # 
 #
 # set any default tuning options for ctdb
index 4d828015a9d0b3f937b6d50b6f5b0e620fe49d75..5fbc104afbf72ab1b4e8db0f817493abb8ace996 100755 (executable)
@@ -551,40 +551,42 @@ startstop_nfs() {
                PLATFORM="rhel"
        }
 
+       _service="${CTDB_NFS_STARTSTOP_WRAPPER} service"
+
        case $PLATFORM in
        sles)
                case $1 in
                start)
-                       service nfsserver start
+                       $_service nfsserver start
                        ;;
                stop)
-                       service nfsserver stop > /dev/null 2>&1
+                       $_service nfsserver stop > /dev/null 2>&1
                        ;;
                restart)
                        echo 0 >/proc/fs/nfsd/threads
-                       service nfsserver stop > /dev/null 2>&1
+                       $_service nfsserver stop > /dev/null 2>&1
                        pkill -9 nfsd
-                       service nfsserver start
+                       $_service nfsserver start
                        ;;
                esac
                ;;
        rhel)
                case $1 in
                start)
-                       service nfslock start
-                       service nfs start
+                       $_service nfslock start
+                       $_service nfs start
                        ;;
                stop)
-                       service nfs stop > /dev/null 2>&1
-                       service nfslock stop > /dev/null 2>&1
+                       $_service nfs stop > /dev/null 2>&1
+                       $_service nfslock stop > /dev/null 2>&1
                        ;;
                restart)
                        echo 0 >/proc/fs/nfsd/threads
-                       service nfs stop > /dev/null 2>&1
-                       service nfslock stop > /dev/null 2>&1
+                       $_service nfs stop > /dev/null 2>&1
+                       $_service nfslock stop > /dev/null 2>&1
                        pkill -9 nfsd
-                       service nfslock start
-                       service nfs start
+                       $_service nfslock start
+                       $_service nfs start
                        ;;
                esac
                ;;
@@ -607,34 +609,36 @@ startstop_nfslock() {
                PLATFORM="rhel"
        }
 
+       _service="${CTDB_NFS_STARTSTOP_WRAPPER} service"
+
        case $PLATFORM in
        sles)
                # for sles there is no service for lockmanager
                # so we instead just shutdown/restart nfs
                case $1 in
                start)
-                       service nfsserver start
+                       $_service nfsserver start
                        ;;
                stop)
-                       service nfsserver stop > /dev/null 2>&1
+                       $_service nfsserver stop > /dev/null 2>&1
                        ;;
                restart)
-                       service nfsserver stop
-                       service nfsserver start
+                       $_service nfsserver stop
+                       $_service nfsserver start
                        ;;
                esac
                ;;
        rhel)
                case $1 in
                start)
-                       service nfslock start
+                       $_service nfslock start
                        ;;
                stop)
-                       service nfslock stop > /dev/null 2>&1
+                       $_service nfslock stop > /dev/null 2>&1
                        ;;
                restart)
-                       service nfslock stop
-                       service nfslock start
+                       $_service nfslock stop
+                       $_service nfslock start
                        ;;
                esac
                ;;