Created
February 19, 2014 22:19
-
-
Save richardking/9102877 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| while true | |
| do | |
| for i in $(grep prod_br_db_slave ~/.ssh/config | sed 's/Host //') ; do sec=$(ssh $i 'mysql -e "show slave status \G" | grep Sec ' | sed "s/Seconds_Behind_Master://"); echo $i; if test $sec -gt 30 ; then echo 'sent email!'; echo $i "delayed" $sec | mail -s 'delay!' [email protected] ; fi & done | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment