]> code.delx.au - mediapc-tools/commitdiff
mythtv-mysql-maintenance
authorJames Bunton <jamesbunton@delx.net.au>
Sun, 25 Mar 2018 00:22:09 +0000 (00:22 +0000)
committerJames Bunton <jamesbunton@delx.net.au>
Sun, 25 Mar 2018 00:22:09 +0000 (00:22 +0000)
mythtv-mysql-maintenance [new file with mode: 0755]

diff --git a/mythtv-mysql-maintenance b/mythtv-mysql-maintenance
new file mode 100755 (executable)
index 0000000..82d1c2f
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+echo "SELECT table_name FROM tables WHERE engine = 'MyISAM' AND table_schema = 'mythconverg'" | \
+    mysql -s information_schema | \
+    awk '{print "REPAIR TABLE " $1 "; OPTIMIZE TABLE " $1 "; ANALYZE TABLE " $1 ";"}' | \
+    mysql -s mythconverg | \
+    grep -i error
+
+mysql -s mythconverg <<EOT
+ALTER TABLE recordedseek ORDER BY chanid, starttime, type;
+ALTER TABLE program ORDER BY starttime, chanid;
+ALTER TABLE filemarkup ORDER BY filename;
+EOT
+
+exit 0