summaryrefslogtreecommitdiff
path: root/share/hydractl/mysql-repair
blob: 00802c507b60f0290560cabe3bf4ac87ce54cac5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/bash
#
# Quick and dirty database repair script!
#

DAMAGED="`grep "Checking table" /var/log/daemon.log | cut -d "'" -f 2 | uniq`"

for damage in $DAMAGED; do
  db="`dirname $damage | sed -e 's|./||'`"
  tb="`basename $damage`"

  echo "Fixing table $tb on db $db..."
  echo "repair table $tb" | mysql $db
done