1
We like to monitor the NAS storage mounted on a Linux box. We only like to be notified via mail when the usage exceeds a certain number, say 80. We have only seen in Linux books where most of them are calling shell scripts at certain times.
How do we write inside crontab to only mail us if it exceeds 80 ?
Usual eg
2 2 * * * /home/someUser/script.sh 2>&1 | mail me@me.com
Looking for solution like below
2 2 * * * if [ someNumber > "80" ] ; then /home/someUser/script.sh | mail me@me.com
3Doing this type of thing in the crontab command line isn't necessary, given that you are running a script. Just test the someNumber value inside the script.sh and do the notification if needed. You can do the mail from inside the script too, rather than trying to put it all into the cron line. – Paul – 2013-10-28T08:48:49.960