Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IOS upgrade with NET::TELNET

Status
Not open for further replies.

modest

ISP
Feb 11, 2001
8
0
0
DK
Hi all
I have started toying with net::telnet, this is my butchered script for ISO upgrades, but it times out leave me with partial images.
can anyone advise wjhat I am missing ?

TIA Sam


use Net::Telnet::Cisco;
$username = "sam";
$password = "cisco";
$enable = "cisco";
my $IP = '10.1.1.1';
my $TFTP = 'cisco/ios/4510/cat4000-i9s-mz.122-25.EWA12.bin';
my $IMAGE = 'cat4000-i9s-mz.122-25.EWA12.bin';

@hosts = qw (
RTR1

);
foreach $host ( @hosts ) {
my $conn = Net::Telnet::Cisco ->new (HOST => $host);
$conn-> login( name => $username,
Password => $password);
if ($conn->enable($enable) ) {
} else {
warn "Can't enable: " . $conn->errmsg;
}
@output=$conn->cmd(
"copy tftp bootflash:
$IP
$TFTP
$IMAGE

");
print @output;

}
 
what's the default timeout for this module (I know Net::Telnet is 10 secs if I remember correctly). You can increase the default timeout, based on the documentation of Net::Telnet::Cisco;
 
Yeah I would set the time out to like 600 secs or something :)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
Thanks for the replies !

I am a total newby, and only managed this script by patching here and there and testing....
can u tell me how to extend the timers ??
 
with out actually looking it up (which you should do) I think it is

my $conn = Net::Telnet::Cisco ->new (HOST => $host, timeout=>'300');

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
Thanks a million travs69

I have actually looked it up, and found
[Timeout => $secs,]);

Now how do I incorporate this in my script was teh problem, I am less then a beginner....but definitely not taking short cuts to get a quick fix.

so please, if u are here to help people like myself dont patronize us.

Thanks again !

Modest (which you should try to be)
 
Thanks a million !!
It works as it should, and save valuable time !!

Modest
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top