Skip to content

Instantly share code, notes, and snippets.

@t0d0r
Created September 12, 2017 09:04
Show Gist options
  • Save t0d0r/c805ed3ae87d13f145f01030175fd125 to your computer and use it in GitHub Desktop.
Save t0d0r/c805ed3ae87d13f145f01030175fd125 to your computer and use it in GitHub Desktop.
cloudstrap
data = <<__EOF__
node-bg-os 127.0.0.1 127.0.0.1
__EOF__
require 'net/ssh'
exit if ARGV[0].nil?
count = 0
data.split(/\n/).each do |line|
name,ip1,ip = line.split(/\s+/)
#puts "#{name}\n#{ip}\n#{ip}\n\n"
print ">> #{name}: "
Net::SSH.start(ip, 'user', :password => "PASSWORD") do |ssh|
# capture all stderr and stdout output from a remote process
output = ssh.exec!("#{ARGV[0]}")
count += output.to_i
puts output
end
# puts "speeping 60 sec"
# sleep 60
end
puts "Total: #{count}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment