How to recieve the output of a command in Net::Telnet perl -


here code

use net::telnet ();   $remote = new net::telnet (timeout => 30,                        prompt => '/>/'); $remote->open("router1");  print $remote->cmd("sh hard\n"); print $remote->cmd("sh hard\n"); print $remote->cmd("sh hard\n"); print $remote->cmd("sh hard\n");  print $remote->waitfor('/mr-ferx2>/'); $remote->close(); 

i trying log router , give "sh hard" command. consistently error. "command timed-out @ telnetter.pl line 9"

and if try instead "sh ver" command on second line

use net::telnet ();   $remote = new net::telnet (timeout => 30,                        prompt => '/>$/'); $remote->open("router1");  print $remote->cmd("sh hard\n"); print $remote->cmd("sh hard\n"); print $remote->cmd("sh hard\n"); print $remote->cmd("sh hard\n");  print $remote->waitfor('/mr-ferx2>/'); $remote->close(); 

it prints output "sh ver" command pattern match timed out error in line before last line.

this prompt router1>

what sequence have follow execute command , make script wait grab output.


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -