I am trying to create a bash script to check that mounts are in place and if not both log the information to a file as well as send out a notification. I am very novice at scripting so some of the ins and outs are elusive to me.
Because we are doing this script to monitor a very finicky piece of software I was hoping to do as much as possible in line rather than have something that creates a config file or what not because I know that if anything is changed as a setting the vendor will say that is the cause of all the issues. Below is the code of what I have come up with so far. I will admit I am not totally confident that anything in the code is going to work so if you see any glaring errors I've made I would love to know about them.
#!/bin/bash
LOGFILE="/tmp/logs/mount.log
TIMESTAMP=`date "+%Y-%m-%d %H:%M:%S"`
while sleep 10m;
do
status=$(for mnt in /reachengine /reachdata/mongo /reachbkups /mnt/AsperaShares /mnt/Editing /mnt/VOD-World/Movies_in_ProRes51_Archive /mnt/Production /mnt/ReachEngine /mnt/ITBackup /mnt/reach '/mnt/Ready for Air' '/mnt/Ready for Reach'; do mountpoint -q "$mnt" || echo "$TIMESTAMP $mnt missing"; done)
[ "$status" ] && echo "$status" >> $LOGFILE
[ "$status" ] && echo "$status" | mail -s "Missing mount" ####@###.##
done