Whamcloud - gitweb
LU-4932 doc: update design doc for LFSCK
[fs/lustre-release.git] / lustre / tests / setup-nfs.sh
index 97c8c31..0d92fa9 100755 (executable)
@@ -1,5 +1,4 @@
 #!/bin/bash
-# vim:expandtab:shiftwidth=4:softtabstop=4:tabstop=4:
 #set -x
 EXPORT_OPTS=${EXPORT_OPTS:-"rw,async,no_root_squash"}
 
@@ -22,9 +21,13 @@ setup_nfs() {
         mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs; }" || return 1
     sleep 5
 
-    do_nodes $LUSTRE_CLIENT "service nfs restart" || return 1
+       do_nodes $LUSTRE_CLIENT "chkconfig --list nfsserver > /dev/null 2>&1 &&
+                                service nfsserver restart ||
+                                service nfs restart" || return 1
 
-    do_nodes $NFS_CLIENTS "service rpcidmapd restart" || return 1
+       do_nodes $NFS_CLIENTS "chkconfig --list rpcidmapd 2>/dev/null |
+                              grep -q rpcidmapd && service rpcidmapd restart ||
+                              true"
 
     do_nodes $LUSTRE_CLIENT "exportfs -o $export_opts_v *:$MNTPNT \
         && exportfs -v" || return 1
@@ -51,10 +54,14 @@ cleanup_nfs() {
     echo -e "\nUnmounting NFS clients..."
     do_nodes $NFS_CLIENTS "umount -f $MNTPNT" || return 1
 
-    echo -e "\nUnexporting Lustre filesystem..."
-    do_nodes $NFS_CLIENTS "service rpcidmapd stop" || return 1
+       echo -e "\nUnexporting Lustre filesystem..."
+       do_nodes $NFS_CLIENTS "chkconfig --list rpcidmapd 2>/dev/null |
+                              grep -q rpcidmapd && service rpcidmapd stop ||
+                              true"
 
-    do_nodes $LUSTRE_CLIENT "service nfs stop" || return 1
+       do_nodes $LUSTRE_CLIENT "chkconfig --list nfsserver > /dev/null 2>&1 &&
+                                service nfsserver stop || service nfs stop" ||
+                               return 1
 
     do_nodes $LUSTRE_CLIENT "exportfs -u *:$MNTPNT" || return 1