Skip to content

Instantly share code, notes, and snippets.

@icheko
Last active April 5, 2017 18:33
Show Gist options
  • Save icheko/d5dcd0d7e70f8c559813 to your computer and use it in GitHub Desktop.
Save icheko/d5dcd0d7e70f8c559813 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
#!/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