diff options
Diffstat (limited to 'extras/mount-shared-storage.sh')
-rwxr-xr-x | extras/mount-shared-storage.sh | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/extras/mount-shared-storage.sh b/extras/mount-shared-storage.sh index 3645a0f42fd..e99233f7e1e 100755 --- a/extras/mount-shared-storage.sh +++ b/extras/mount-shared-storage.sh @@ -2,35 +2,38 @@ #Post reboot there is a chance in which mounting of shared storage will fail #This will impact starting of features like NFS-Ganesha. So this script will #try to mount the shared storage if it fails -#TODO : Do it for other glusterfs clients in /etc/fstab -volume="gluster_shared_storage" -mp="/var/run/gluster/shared_storage" -#check if there is fstab entry for shared storage -gfc=$(sed -e 's/#.$//' </etc/fstab | grep -c $volume) -if [ $gfc -eq 0 ] -then - exit 0 -fi +exitStatus=0 -#check whether shared storage is mounted -#if it is mounted then mount has inode value 1 -inode=$(ls -id $mp | awk '{print $1}') +while IFS= read -r glm +do + IFS=$' \t' read -r -a arr <<< "$glm" -if [ $inode -eq 1 ] -then - exit 0 -fi + #Validate storage type is glusterfs + if [ "${arr[2]}" == "glusterfs" ] + then -mount -t glusterfs localhost:/$volume $mp -#wait for few seconds -sleep 5 + #check whether shared storage is mounted + #if it is mounted then mountpoint -q will return a 0 success code + if mountpoint -q "${arr[1]}" + then + echo "${arr[1]} is already mounted" + continue + fi -#recheck mount got succeed -inode=$(ls -id $mp | awk '{print $1}') -if [ $inode -eq 1 ] -then - exit 0 -else - exit 1 -fi + mount -t glusterfs "${arr[0]}" "${arr[1]}" + #wait for few seconds + sleep 10 + + #recheck mount got succeed + if mountpoint -q "${arr[1]}" + then + echo "${arr[1]} has been mounted" + continue + else + echo "${arr[1]} failed to mount" + exitStatus=1 + fi + fi +done <<< "$(sed '/^#/ d' </etc/fstab | grep 'glusterfs')" +exit $exitStatus |