Skip to content

Instantly share code, notes, and snippets.

@richardking
Created February 19, 2014 22:19
Show Gist options
  • Select an option

  • Save richardking/9102877 to your computer and use it in GitHub Desktop.

Select an option

Save richardking/9102877 to your computer and use it in GitHub Desktop.
#!/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