Created
September 12, 2017 09:04
-
-
Save t0d0r/c805ed3ae87d13f145f01030175fd125 to your computer and use it in GitHub Desktop.
cloudstrap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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