Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HOSTLIST.each do |host|
- begin
- Net::SSH.start(host, USER, :password => PASSWORD, :timeout => TIMEOUT) do |ssh|
- output = ssh.exec!('ls')
- puts output
- end
- rescue Timeout::Error
- puts "+++++++ Timed out"
- rescue Errno::EHOSTUNREACH
- puts "+++++++ Host unreachable"
- rescue Errno::ECONNREFUSED
- puts "+++++++ Connection refused"
- rescue Net::SSH::AuthenticationFailed
- puts "+++++++ Authentification failure "
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement