Last active
February 19, 2018 10:21
-
-
Save alexalouit/1620c5c555717d5bda4f to your computer and use it in GitHub Desktop.
mountpoint checker/alert/remounter
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 | |
# | |
# cron ex: * * * * * /usr/bin/nice -n 19 /usr/bin/ionice -c2 -n7 /root/scripts/check-mountpoint.sh >> /root/scripts/cron.log | |
# mountpoint must be present in fstab | |
mountpoint=" /mnt/endpoint" # use space before (prevent mountpoint as source) | |
email="" | |
if [ -z "$(grep $mountpoint /proc/mounts)" ]; then | |
# we use space before, prevent mountpoint as source | |
echo "$mountpoint not present" | |
unmount $mountpoint | |
mount $mountpoint | |
echo -e "Erreur du point de montage $(mountpoint) sur le serveur:\n $(hostname)" | mail -s "Rapport d'erreur point de montage" $email | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment