Skip to content

Instantly share code, notes, and snippets.

@ashleyhindle
Created September 4, 2015 12:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashleyhindle/37a02f4d23e59aede1d0 to your computer and use it in GitHub Desktop.
Save ashleyhindle/37a02f4d23e59aede1d0 to your computer and use it in GitHub Desktop.
Monitor mysql slave status
#!/bin/bash
watch -n 0.5 "echo 'show slave status\G' | mysql -uslave --password=slave | grep -v 'Ignore\|SSL\|Auto_P\|Until\|Last_IO\|Gtid' | tee /tmp/slave-status; grep Behind /tmp/slave-status | awk -F: '{print \$2/3600\" hours behind\"}'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment