Skip to content

Instantly share code, notes, and snippets.

@icheko
Last active December 31, 2015 19:49
Show Gist options
  • Save icheko/8036339 to your computer and use it in GitHub Desktop.
Save icheko/8036339 to your computer and use it in GitHub Desktop.
Check if NFS mount is present, else attempt to remount. Usage: ./checkNFSMount.sh /mount/point
#!/bin/sh
#
# USAGE: ./checkNFSMount.sh /san
#
for i in `cat /proc/mounts | cut -d' ' -f2`; do
if [ "x$1" = "x$i" ]; then
exit
fi
done
echo "NFS is unmounted"
echo "================"
echo "lazy unmounting $1..."
# lazy unmount
umount -l $1
echo "sleep...15"
# wait
sleep 15
echo "mount $1"
# mount
mount $1
echo "done!"
echo "================"
df -h
echo "================"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment