Skip to content

Instantly share code, notes, and snippets.

@wheatdog
Created February 25, 2017 10:46
Show Gist options
  • Select an option

  • Save wheatdog/6e120eb85156489dcb3bca899fca420c to your computer and use it in GitHub Desktop.

Select an option

Save wheatdog/6e120eb85156489dcb3bca899fca420c to your computer and use it in GitHub Desktop.
nfs-check.sh
#!/bin/sh
stat_timeout=0.3 #seconds
for mp in $(mount -t nfs4 | awk '{print $3}'); do
timeout -s kill ${stat_timeout} stat -t "$mp" > /dev/null
if [ $? == 137 ]; then
printf 'unmount %s\n' "${mp}"
#umount -f "${mp}"
else
printf '%s is healthy\n' "${mp}"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment