Created
October 1, 2014 17:15
-
-
Save fduran/e6229925993be4d50e2d to your computer and use it in GitHub Desktop.
Check and alert if mysql slave is not running
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/bash | |
# check if mysql slave is running | |
log=/var/log/mysqlslave.log | |
[email protected] | |
date >> $log | |
res=`mysql -u root -pPassword -h db.example.com -N -B -e "show status like 'Slave_running'"|cut -f2` | |
if [ $res = 'ON' ] | |
then | |
echo 'running' >> $log | |
else | |
echo 'NOT RUNNING' >> $log | |
echo "Mysql slave not running" |mail -s "Slave not running" $email | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment