Hi Gurus,
I want to create a script to check the status of the mysql db tables, have already done it, my script is creating a simple file with all the status info, and sending me an email too.
But what I’m looking for;
I just want to get an email, when the status is not equal to OK … that’s it.
Can any one help, thanks, best regards.
EL
script:
=======
#!/bin/bash
#Set Credentials
export HOST=`hostname`
export USER=abcd
export PASSWORD=abcd
export DATABASE=abcd
export FILE=/home/mysql/$DATABASE_check.txt
## checking process
echo checking process of $DATABASE@$HOST
echo
echo START_TIME “>>>>>> `date +%m_%d_%Y:%H:%M:%S`”
mysqlcheck –user=$USER –password=$PASSWORD $DATABASE
echo END_TIME “>>>>>> `date +%m_%d_%Y:%H:%M:%S`”
mail -s “MySql Tables check – abcd@abcd ” [email protected] check.log &
Answer #1
Hello,
A simple way to do this would be to set a second script to run on a cron, that greps /home/mysql/$DATABASE_check.txt and emails you if certain keywords are found.