-
-
Save jpgrace/8d5823fc10c487f53748c003390fe020 to your computer and use it in GitHub Desktop.
Check if S3FS mount is not connected and attempt to reconnect Usage: ./checkNFSMount.sh /mount/point
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
MNT_PATH=$1 | |
if [ -z "$MNT_PATH" ] | |
then | |
echo "MNT_PATH is not set" | |
exit | |
fi | |
DF_OUTPUT=$((df -h | grep $MNT_PATH) 2>&1) | |
if [[ "$DF_OUTPUT" != *"endpoint is not connected"* ]] | |
then | |
exit; | |
fi | |
echo "NFS is unmounted" | |
echo "================" | |
echo "lazy unmounting $1..." | |
# lazy unmount | |
umount -l $1 | |
echo "sleep...15" | |
# wait | |
sleep 15 | |
echo "mount fstab" | |
# mount | |
mount -a | |
echo "done!" | |
echo "================" | |
df -h |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment