create a startstop_nfs function that can start/stop the nfs service of different...
authorRonnie Sahlberg <sahlberg@samba.org>
Sun, 10 Feb 2008 22:35:37 +0000 (09:35 +1100)
committerRonnie Sahlberg <sahlberg@samba.org>
Sun, 10 Feb 2008 22:35:37 +0000 (09:35 +1100)
config/events.d/60.nfs
config/functions

index 09a09a2a7f3dcb013b79bca9d78d8b08d4e0478e..c84e7bed1995a8092ee65b123e7663116b27c1ba 100755 (executable)
@@ -12,6 +12,8 @@ shift
 
 PATH=/usr/bin:/bin:/usr/sbin:/sbin:$PATH
 
+
+
 case $cmd in 
      startup)
        /bin/mkdir -p $CTDB_BASE/state/nfs
@@ -21,17 +23,12 @@ case $cmd in
        /bin/rm -f $CTDB_BASE/state/statd/statd.restart >/dev/null 2>/dev/null
 
        # make sure nfs is stopped before we start it, or it may get a bind error
-       service nfs stop > /dev/null 2>&1
-       service nfslock stop > /dev/null 2>&1
-
-       service nfslock start
-       service nfs start
+       startstop_nfs stop
+       startstop_nfs start
        ;;
 
      shutdown)
-       # shutting down nfs can take a while so put it in the background
-       service nfs stop &
-       service nfslock stop &
+       startstop_nfs stop
        exit 0
        ;;
 
index e60427ff4c47fcc04966ad51726c2b52c3586b17..3a5744f108122f5242d98c1cf8e7e3555006e87b 100644 (file)
@@ -227,3 +227,44 @@ kill_tcp_connections() {
     echo "killed $_killcount TCP connections to released IP $_IP"
 }
 
+########################################################
+# start/stop the nfs service on different platforms
+########################################################
+startstop_nfs() {
+       PLATFORM="unknown"
+       [ -x /etc/init.d/nfsserver ] && {
+               PLATFORM="sles"
+       }
+       [ -x /etc/init.d/nfslock ] && {
+               PLATFORM="rhel"
+       }
+
+       case $PLATFORM in
+       sles)
+               case $1 in
+               start)
+                       service nfsserver start
+                       ;;
+               stop)
+                       service nfsserver stop > /dev/null 2>&1
+                       ;;
+               esac
+               ;;
+       rhel)
+               case $1 in
+               start)
+                       service nfslock start
+                       service nfs start
+                       ;;
+               stop)
+                       service nfs stop > /dev/null 2>&1
+                       service nfslock stop > /dev/null 2>&1
+                       ;;
+               esac
+               ;;
+       *)
+               echo "Unknown platform. NFS is not supported with ctdb"
+               exit 1
+               ;;
+       esac
+}