nigels has asked for the wisdom of the Perl Monks concerning the following question:
Hi I have put together a a basic telnet script script . I can get it to work fine for simple commands but what I want to do is replicate a script I user over ssh to spool the <STDOUT> to a file. The problem I keep hitting is the script runs and produces a page of info with a more at the bottom and then halts and then the script times out. I know it is doing this as I trace the TCP connection with ethereal and I can see the command execute and return a screen full of data with the more at the bottom
The basic script looks like this. If I change the comand to an 'ls' it works a treat
use Net::Telnet (); use warnings; my $host ='somehost'; my $username ='user'; my $passwd = 'password'; #my $prompt = 'prompt'; my $cmd = '/ flow export fcap "src net a.b.c.d " recent'; # my $cmd ='ls'; $telnet = Net::Telnet ->new (Timeout => 20, Host=> $host, Prom +pt => "/$prompt/"); $telnet ->login(Name =>$username, Password => $passwd); @lines = $telnet ->cmd($cmd); $telnet -> close; pop @lines; print @lines;
Cheers Nigel
Edited by Chady -- code tags.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: problem with net::telnet moduleand STDOUT
by tachyon (Chancellor) on Jul 26, 2004 at 11:07 UTC | |
by nigels (Initiate) on Jul 26, 2004 at 12:20 UTC | |
by tachyon (Chancellor) on Jul 26, 2004 at 12:41 UTC | |
by nigels (Initiate) on Jul 26, 2004 at 13:57 UTC | |
by tachyon (Chancellor) on Jul 26, 2004 at 14:06 UTC | |
|
Re: problem with net::telnet moduleand STDOUT
by eXile (Priest) on Jul 26, 2004 at 15:03 UTC | |
|
Re: problem with net::telnet moduleand STDOUT
by vladdrak (Monk) on Jul 27, 2004 at 05:56 UTC |