summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-03-17 18:32:55 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-03-17 18:32:55 -0300
commitb5450413341f3cfd3876e87cdbf1195da56dd8bc (patch)
tree7b0622e4452ceaad7f1e0a4e4cd650934ce91990
parent27827c5c1532ab4e4d1c3b56cb7801a40174b53e (diff)
downloadhydra-b5450413341f3cfd3876e87cdbf1195da56dd8bc.tar.gz
hydra-b5450413341f3cfd3876e87cdbf1195da56dd8bc.tar.bz2
Adding mysql-repair script
-rw-r--r--TODO.md1
-rwxr-xr-xshare/hydractl/mysql-repair14
2 files changed, 15 insertions, 0 deletions
diff --git a/TODO.md b/TODO.md
index 940ef5e..9f7b6fc 100644
--- a/TODO.md
+++ b/TODO.md
@@ -15,3 +15,4 @@ Hydractl
- backup-restore-user and backup-restore-users.
- hydractl backup-restore-site {debian,wiki}.
- wrapper to import/export monkeysphere keys into keyringer.
+ - enhance mysql-repair
diff --git a/share/hydractl/mysql-repair b/share/hydractl/mysql-repair
new file mode 100755
index 0000000..00802c5
--- /dev/null
+++ b/share/hydractl/mysql-repair
@@ -0,0 +1,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