"Fossies" - the Fresh Open Source Software Archive

Member "glusterfs-8.2/extras/mount-shared-storage.sh" (16 Sep 2020, 931 Bytes) of package /linux/misc/glusterfs-8.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/bash
    2 #Post reboot there is a chance in which mounting of shared storage will fail
    3 #This will impact starting of features like NFS-Ganesha. So this script will
    4 #try to mount the shared storage if it fails
    5 
    6 exitStatus=0
    7 
    8 while IFS= read -r glm
    9 do
   10     IFS=$' \t' read -r -a arr <<< "$glm"
   11 
   12     #Validate storage type is glusterfs
   13     if [ "${arr[2]}" == "glusterfs" ]
   14     then
   15 
   16         #check whether shared storage is mounted
   17         #if it is mounted then mountpoint -q will return a 0 success code
   18         if mountpoint -q "${arr[1]}"
   19         then
   20             echo "${arr[1]} is already mounted"
   21             continue
   22         fi
   23 
   24         mount -t glusterfs -o "${arr[3]}" "${arr[0]}" "${arr[1]}"
   25         #wait for few seconds
   26         sleep 10
   27 
   28         #recheck mount got succeed
   29         if mountpoint -q "${arr[1]}"
   30         then
   31             echo "${arr[1]} has been mounted"
   32             continue
   33         else
   34             echo "${arr[1]} failed to mount"
   35             exitStatus=1
   36         fi
   37     fi
   38 done <<< "$(sed '/^#/ d' </etc/fstab | grep 'glusterfs')"
   39 exit $exitStatus