Last active
June 22, 2017 13:14
-
-
Save namenu/11129988 to your computer and use it in GitHub Desktop.
MySQL crontab
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 | |
MYSQL=`mysql --defaults-file=/etc/mysql/debian.cnf -e "SHOW GLOBAL STATUS LIKE 'Slave_running'" | grep 'Slave_running' | awk '{ print $2 }'` | |
res="$MYSQL" | |
if [ $res != "ON" ]; then | |
touch replication.broken | |
echo 'Replication was broken' | /usr/bin/mail -s 'echo 'Replication was broken' | /usr/bin/mail -s "[`hostname`] Replication was broken"' [email protected] | |
fi | |
#MYSQL=`mysql --defaults-file=/etc/mysql/debian.cnf -e "SHOW SLAVE STATUS\G"` |
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 | |
pt-query-digest /storage/mysql/slow.log | mail -s 'echo 'Replication was broken' | /usr/bin/mail -s "[`hostname`] Replication was broken"' [email protected] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment