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

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced: Re: [cuboidgraphix] Help with Telnet commands.: Edit Log



FishMonger
Veteran / Moderator

Jan 22, 2009, 7:42 AM


Views: 5623
Re: [cuboidgraphix] Help with Telnet commands.


Code
#!/usr/bin/perl  
# This file is the clear.pl
# 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(Prompt => '/login:/');

$t->open($server);
$t->login($user, $pass);
$t->waitfor('/%/');
$t->print("cliapp");
$t->waitfor('/>/');
$t->print("alarm;");
$t->waitfor('/FaultName/');

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

foreach my $line (split /\n/, $data) {
my (undef, $index, $status, $activity, $datetime, $source, $severity, $faultname) = quotewords('\s+', 0, $line);

if ($faultname =~ /^SWERR/){
print $index, "\n";
print $faultname, "\n";
$t->print("cd $source;");
$t->waitfor('/>/');
$t->print("action uploadlogsfromcc1;");
$t->waitfor('/>/');
}
}



(This post was edited by FishMonger on Jan 22, 2009, 7:43 AM)


Edit Log:
Post edited by FishMonger (Veteran) on Jan 22, 2009, 7:43 AM


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

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