Skip to content

Instantly share code, notes, and snippets.

@justinvt
Created March 12, 2010 17:07
Show Gist options
  • Save justinvt/330532 to your computer and use it in GitHub Desktop.
Save justinvt/330532 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
servers = [:tweety_jobs_01, :tweety_jobs_02,:tweety_jobs_03,:db_master,:db_slave,:batch_01,:batch_02]
servers = servers.map(&:to_s).grep( Regexp.new "^" + ARGV[0] ) if ARGV.size == 2
p "Executing #{ARGV[-1].dump} on #{servers.map(&:to_s).join(',')}"
servers.each do |server|
p ("=" * 10) + server.to_s + ("=" * 10)
command = 'ssh -p3222 root@' + server.to_s + ' "' + ARGV[-1].to_s.dump + '"'
p command
system command
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment