split on new line, which fixes an issue if no table is found
This commit is contained in:
parent
3820ed70a0
commit
fd71b9473f
1 changed files with 1 additions and 1 deletions
|
@ -3,7 +3,7 @@
|
|||
# set home as we runit as weekly cron, where HOME is /
|
||||
ENV['HOME'] = '/root'
|
||||
tables = %x{mysql -Bse "SELECT TABLE_SCHEMA,TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA NOT IN ('information_schema','mysql') AND Data_free > 0 AND ENGINE IN ('MyISAM','InnoDB','ARCHIVE')"}
|
||||
tables.each do |table|
|
||||
tables.split("\n").each do |table|
|
||||
tableitems = table.chomp.split(/\t/)
|
||||
output = %x{mysql #{tableitems[0]} -Bse "OPTIMIZE TABLE \\`#{tableitems[0]}\\`.\\`#{tableitems[1]}\\`" 2>&1}
|
||||
unless output =~ /status\t+OK/
|
||||
|
|
Loading…
Reference in a new issue