Created
July 9, 2014 09:38
-
-
Save benoitjpnet/519fcb26e8a9c2fadb31 to your computer and use it in GitHub Desktop.
Check for crashed MySQL table in syslog and launch a repair.
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 | |
tables=$(grep crashed /var/log/syslog | grep -Eo \'\./.*\' --color=auto | sed s#\'./## | sed s#\'## | uniq | tr -s '\n' ' ') | |
for tableC in $tables; do | |
db=${tableC%/*} | |
table=${tableC#*/} | |
mysqlcheck --auto-repair --check $db $table | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment