📄 all.pl
字号:
use Net::FTP;
use FileHandle;
#use strict;
my ($Ftp_IP,$Ftp_username,$Ftp_password,$Ftp_path);
my $temp_nename;
my $wfd_fault;
my $now_ne;
my $time_date = sprintf '%04d%02d%02d', (localtime)[5] +1900, (localtime)[4]+1, (localtime)[3];
my $time_yestoday = sprintf 'MY%02d', (localtime)[3]-1;
my @file_list,$len_list;
my $user_file;
my $ff1,$ff2;
#=======FTP服务端信息========
sub Eric_Link_Speed {
my ($lines) = @_;
my $flag;
my ($int_id,$ne_name,$spc,);
$flag="0";
for(my $i=0; $i < @$lines; $i++){
if ($lines->[$i]=~/\s*LS\s+SPID\s*/) {
if ($lines->[$i+1]=~/\s*(\S+)\s+\S+\s*/) {
$spc=$1;
}
for(; $i < @$lines; $i++){
if ($lines->[$i]=~/\s*SLC\s+ACL\s*/) {
if ($lines->[$i+1]=~/\s*C7STAH\s*/) {
$flag="C7STAH";
print $wfd_fault "$spc,$flag,H;";
last;
}
elsif ($lines->[$i+1]=~/\s*C7ST2C\s*/) {
$flag="C7ST2C";
print $wfd_fault "$spc,$flag,L;";
last;
}
else{
print $wfd_fault "$spc,,;";
last;
}
}
}
$spc="";
}
}
#打印一个空格
print $wfd_fault " ";
}
sub Ps_java {
my ($lines) = @_;
my $flag;
my $ls,$pid;
$flag=0;
for(my $i=0; $i < @$lines; $i++){
if ($lines->[$i]=~/classpath\s*\/home\/omp\/tnmseoms210\/conf/) {
$flag=1;
}
}
print $wfd_fault "$flag";
}
sub eaw_check {
my ($lines) = @_;
my $flag;
$flag=0;
for(my $i=0; $i < @$lines; $i++){
if ($lines->[$i]=~/\((\S+) is not defined/) {
$flag=1;
print $wfd_fault "$1,";
}
}
if ($flag==0) {
print $wfd_fault " ";
}
}
sub parse_message
{
my ($record_id, $lines) = @_;
my ($handler_id);
my %handler = ( 'Eric_Link_Speed' => \&Eric_Link_Speed,
'Ps_java' => \&Ps_java,
'eaw_check' => \&eaw_check
);
# print "parse record $record_id...\n";
foreach $handler_id (keys %handler) {
if($record_id eq $handler_id){
print "processing record $record_id...\n";
$handler{$record_id}->($lines);
return 1;
}
}
return 0;
}
############################################################################
#
# Main
#
############################################################################
if(@ARGV != 3)
{
print "\nUsage: $0 <source_cmd> <source_file> <dest_faultfile>\n\n";
exit -1;
}
my ($line);
my $Usage ="\nUsage: $0 <source_cmd> <source_file> <dest_faultfile>\n\n";
my ($sourcefile) = $ARGV[1];
my @msg = ( );
my $source_cmd = $ARGV[0];
my $rfd = new FileHandle("$ARGV[1]") || die "Can not open $ARGV[1]\n";
$wfd_fault = new FileHandle(">$ARGV[2]") || die "Can not Create $ARGV[2]\n";
while($line = <$rfd>)
{
push @msg, $line;
}
parse_message($source_cmd, \@msg);
$wfd_fault.close;
exit(0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -