Skip to content

Instantly share code, notes, and snippets.

@tadman
Created April 13, 2009 17:33
Show Gist options
  • Save tadman/94564 to your computer and use it in GitHub Desktop.
Save tadman/94564 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/environment'
conn = ActiveRecord::Base.connection
STDOUT.sync = true
while (true)
print "\e[;H"
print "\e[J"
print "\e[;H"
puts "DB Status\e[K"
print "\e[7m"
print "%5s %10s %10s %18s %8s %5s %10s %s" % [ 'PID', 'User', 'Host', 'DB', 'Command', 'Time', 'State',' Info' ]
print "\e[K\e[0m\n"
conn.select_rows("SHOW PROCESSLIST").each do |row|
puts "%5d %10s %10s %18s %8s %5d %10s %s" % row
end
sleep(1)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment