From: Paul Lutus Date: 2006-09-08T02:55:24+09:00 Subject: Re: Telnet and 'waitfor' David Corticchiato wrote: > Tim Pease wrote: > >> Just curious, but are you trying to connect to an APC Power >> Distribution Unit? Your choice of variable names -- @apc_ip -- just >> made me think of the APC PDUs we have here at work. > > Yes I work with APC PDU. ;) > > >> Try setting 'Output_log' to a filename when you create your telnet >> session. This will copy all telnet traffic to the given log file. > > > Ok, so i tried with function made to that : 'login'. Here is my code : Try something like this: ------------------------------------------- #! /usr/bin/ruby require 'net/telnet' session = Net::Telnet.new( "Host" => "hostname", "Timeout" => 10, "Prompt" => /[$%#>] \z/n ) session.login("username","password") session.cmd("ls -la") { |c| print c } session.close -- Paul Lutus http://www.arachnoid.com