Merge remote-tracking branch 'origin/master' into development
This commit is contained in:
commit
bec7f593fa
@ -30,6 +30,12 @@ is_nfs_mounted() {
|
||||
mount | grep -q "${mount_point}"
|
||||
}
|
||||
|
||||
# Check if the mount point directory is accessible (i.e. can be listed)
|
||||
is_mount_accessible() {
|
||||
local mount_point=$1
|
||||
ls -1 "${mount_point}" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Main Loop: Process Each Server and Its Mount Points
|
||||
###############################################################################
|
||||
@ -82,17 +88,29 @@ for server in "${SERVERS[@]}"; do
|
||||
sudo mkdir -p "${MOUNT_POINT}"
|
||||
fi
|
||||
|
||||
# Mount the NFS share if it's not already mounted.
|
||||
if ! is_nfs_mounted "${MOUNT_POINT}"; then
|
||||
echo "[INFO] NFS share is not mounted at ${MOUNT_POINT}. Attempting to mount..."
|
||||
sudo mount -t nfs -o ro,port="${LOCAL_PORT}",nolock,soft,timeo=5,retrans=3 127.0.0.1:"${NFS_SHARE}" "${MOUNT_POINT}"
|
||||
if is_nfs_mounted "${MOUNT_POINT}"; then
|
||||
echo "[SUCCESS] NFS share mounted successfully at ${MOUNT_POINT}."
|
||||
# Check if the NFS share is mounted and accessible.
|
||||
if is_nfs_mounted "${MOUNT_POINT}"; then
|
||||
if ! is_mount_accessible "${MOUNT_POINT}"; then
|
||||
echo "[WARNING] Mount point ${MOUNT_POINT} is not accessible. Attempting to remount..."
|
||||
sudo umount "${MOUNT_POINT}"
|
||||
sleep 2
|
||||
sudo mount -t nfs -o ro,port="${LOCAL_PORT}",nolock,soft,timeo=5,retrans=3 127.0.0.1:"${NFS_SHARE}" "${MOUNT_POINT}"
|
||||
if is_mount_accessible "${MOUNT_POINT}"; then
|
||||
echo "[SUCCESS] Remounted successfully and folder is now accessible."
|
||||
else
|
||||
echo "[ERROR] Remount failed, folder still not accessible."
|
||||
fi
|
||||
else
|
||||
echo "[ERROR] Failed to mount NFS share ${NFS_SHARE} at ${MOUNT_POINT}!"
|
||||
echo "[INFO] NFS share is mounted and accessible at ${MOUNT_POINT}."
|
||||
fi
|
||||
else
|
||||
echo "[INFO] NFS share is already mounted at ${MOUNT_POINT}."
|
||||
echo "[INFO] NFS share is not mounted at ${MOUNT_POINT}. Attempting to mount..."
|
||||
sudo mount -t nfs -o ro,port="${LOCAL_PORT}",nolock,soft,timeo=5,retrans=3 127.0.0.1:"${NFS_SHARE}" "${MOUNT_POINT}"
|
||||
if is_mount_accessible "${MOUNT_POINT}"; then
|
||||
echo "[SUCCESS] NFS share mounted successfully at ${MOUNT_POINT}."
|
||||
else
|
||||
echo "[ERROR] Failed to mount NFS share ${NFS_SHARE} at ${MOUNT_POINT} or folder not accessible!"
|
||||
fi
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user