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 and shell scripting languages 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 08:30 PM
Linux LiveCD Router 2.0.26 (Default Router branch) iBot Software Releases - RSS News 0 03-03-2008 05:00 AM
SSH to Router in Script earnstaf Shell Programming and Scripting 0 07-17-2007 02:42 PM
DSL Router praveenk UNIX for Advanced & Expert Users 9 08-29-2002 06:19 PM
router matt2kjones Security 1 07-18-2002 05:08 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-05-2007
moutaz1983 moutaz1983 is offline
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?
  #2 (permalink)  
Old 12-05-2007
moutaz1983 moutaz1983 is offline
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" ;
  #3 (permalink)  
Old 12-06-2007
moutaz1983 moutaz1983 is offline
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 ???
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:50 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0