#!/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 <