Fix command output capturing in optimize_tables.rb for Ruby 1.9
This commit is contained in:
parent
f34882cadd
commit
8fbc1b33ee
1 changed files with 2 additions and 1 deletions
|
@ -2,7 +2,8 @@
|
|||
|
||||
# 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 = %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 = tables.split(/\n/)
|
||||
tables.each { |table|
|
||||
tableitems = table.chomp.split(/\t/)
|
||||
system "mysql #{tableitems[0]} -Bse \"OPTIMIZE TABLE \\`#{tableitems[0]}\\`.\\`#{tableitems[1]}\\`\" | grep -q OK"
|
||||
|
|
Loading…
Reference in a new issue