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.
In reply to problem with net::telnet moduleand STDOUT by nigels
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |