Created
December 18, 2012 22:25
-
-
Save anonymous/4332653 to your computer and use it in GitHub Desktop.
This file contains 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
i = (name.count - 1) | |
begin | |
router_telnet_wrap = Net::SSH::Telnet.new( | |
"Dump_log" => "dump_log.txt", | |
"Host" => "#{ip.fetch(i)}", | |
"Username" => "#{login.fetch(i)}", | |
"Password" => "#{pw.fetch(i)}", | |
"Timeout" => 60, | |
"Prompt" => /#{prompt.fetch(i)}/ | |
) | |
rescue => e | |
puts e | |
next | |
load_commands = [] | |
load_commands = File.open("/var/www/alpha_rel_1/temp_files/#{name[i]}.txt").readlines.map(&:chomp) | |
puts load_commands | |
load_commands.each do |x| | |
@to_output = router_telnet_wrap.cmd(x) | |
puts @to_output | |
output_file = File.open("/var/www/alpha_rel_1/output/#{name[i]}-output-#{@tstamp}.txt", "a+") | |
output_file.write(@to_output) | |
output_file.close | |
end | |
i-=1 | |
end while i > 0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment