Hey all
how do i continue on error ? i have a list with 7 ip
nummers in it , and all except one runs fine but the 1
fails to accept this command
"sho poli int fas 0 | in exceeded"
it sould be
"sho poli int fas 0/0 | in exceeded"
the script just breaks and stops with the following error,
FTF-A#sho poli int fas 0 | in exceeded
^
% Invalid input detected at '^' marker.
i could overcome this problem by using errmode "return" ,
but it there not a way for me to check the result for last
output so if one command fails i could send the router
another command.
#!/usr/bin/perl -w
#
#
use Net::Telnet::Cisco;
use strict;
use warnings;
my $line;
my @file;
my ($Fixed_Year,$RealMonth,$Second,$Minute,$Hour,
$Day,$Month,$Year,$WeekDay,$DayOfYear,$IsDST);
my $get_times = get_time();
my $timeout_cmd = 30;
if (open (FILE, "qos_account_list")) {
@file = <FILE>;
close (FILE);
foreach $line (@file) {
#****************************************************************
*******
#Opret forbindelse til Router
#****************************************************************
*******
my $session = Net::Telnet::Cisco->new(Host => $line);
if ($session) {
$session->login("xxxx", "xxxx");
my @output = $session->cmd(String => "sho poli
int fas 0 | in exceeded");
foreach my $line (@output) {
if ($line =~ /exceeded/ ) {
print "this\n";
}
if ($line =~ /Invalid input detected/ ) {
print "that";
}
}
}
}
}
Best Regards
per_joe@yahoo.dk
Logged In: NO
I have the same question. I have list of 700 IPs and if one gets timeout my script stop. how can I avoid that??
thanks