The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Linux LiveCD Router 2.0.27 (Default Router branch) iBot Software Releases - RSS News 0 05-14-2008 04:30 PM
Linux LiveCD Router 2.0.26 (Default Router branch) iBot Software Releases - RSS News 0 03-03-2008 02:00 AM
SSH to Router in Script earnstaf Shell Programming and Scripting 0 07-17-2007 10:42 AM
DSL Router praveenk UNIX for Advanced & Expert Users 9 08-29-2002 02:19 PM
router matt2kjones Security 1 07-18-2002 01:08 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 12-05-2007
Registered User
 

Join Date: Dec 2007
Posts: 24
Script to run on a router

I want to make a Perl script to telnet to a router and apply commands, and get the output of the commands in a file.

Can any one help me in that?
Reply With Quote
Forum Sponsor
  #2  
Old 12-05-2007
Registered User
 

Join Date: Dec 2007
Posts: 24
Can't any one help me, I find the script to login to router but the issue is to redirect the output of commands to a file.

#!/usr/local/bin/perl
#

use Net::Telnet ();

$machine = '1.1.1.1';
$logfile = "cisco.log";

$t = new Net::Telnet (Timeout => 10);
$t->input_log($logfile);
$t->open($machine);
print "Connected to $machine\n";
$t->waitfor('/Username: $/');
$t->print("cisco");
$t->waitfor('/Password: $/');
$t->print("cisco");
$t->prompt('/LTD-INC>/');
$t->cmd("enable");
$t->waitfor('/Password: $/');
$t->print("cisco");
$t->prompt('/LTD-INC#/');

$t->cmd("show run");

????????????????????? This is what I don't know ?????????????????

print "Logged in successfully.\n";
print "Collecting informations";
print "done.\n";
print "Most heavy connection/s :\n" ;
Reply With Quote
  #3  
Old 12-06-2007
Registered User
 

Join Date: Dec 2007
Posts: 24
I have the script now running on cisco routers, but on Juniper routers, it time out and not continue.

Can Any one help me important , PLZ ???
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 07:01 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0