CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Advanced: Help with Telnet commands.: Edit Log


Jan 21, 2009, 2:15 PM

Views: 7147
Help with Telnet commands.

Hi again guys,

Well I've still been trying on my own and I've recently ran into a snag with a script of mine...

The code is as follows:

# This file is the
# This is a script that will telnet into the BSM,
# and clear all SWERR and erase all cleared alarms.

use strict;
use warnings;
use Net::Telnet;
use Text::ParseWords;
use POSIX qw/strftime/;

my $date = strftime("%Y-%m-%d", localtime(time));
my $temp = "/home/bsm/data/temp.txt";
my $user="USR";
my $pass="PWD";
my $server="HOST";
my $t = Net::Telnet->new($server);

my ($data) = $t->waitfor('/>/');

open(WRITE, ">", "$temp")
or die "Can't open 'temp.txt' $!";
print WRITE $data;
close WRITE;

my $file = $temp || die "Usage: $0 <filename>\n";
open my $FH, '<', $file or die "Can't open '$file' $!";

while (<$FH>) {
if($_ =~ /^#/){
my (undef, $index, $status, $activity, $datetime, $source, $severity, $faultname) = quotewords('\s+', 0, $_);

foreach($faultname =~ /SWERR/){
print $index, "\n";
print $faultname, "\n";
$t->waitfor('/>/'); ## REMOVED THIS LINE ##
$t->print("cd $source;");
$t->print("action uploadlogsfromcc1;");


Now ... when I run this code I get the following..

SWERR log threshold exceeded at CEM, please upload the log // [XCEM] SWERR Log
pattern match timed-out at ./ line 45

Why is it that my script is timing out? Can you help Fish or Kevin?

Thanks a lot.


I removed the waitfor line and it worked. But the alarms still didn't clear up.. I think I need to put a sleep(3); on each command.

Will keep you posted.

(This post was edited by cuboidgraphix on Jan 21, 2009, 2:30 PM)

Edit Log:
Post edited by cuboidgraphix (User) on Jan 21, 2009, 2:25 PM
Post edited by cuboidgraphix (User) on Jan 21, 2009, 2:30 PM

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives