<pre name="code" >#!/usr/bin/perl $dir = '/home/websphere/WebSphere/AppServer/profiles/AppSrv01/logs/server1';$file = '1.log';$mon_file = "$dir/$file";print "$mon_file is $mon_file\n";@warn_arr = qw/连接已关闭 NullPointException IndexOutOfBound exception/;foreach $a (@warn_arr) { undef @err_info; open( C,"<","$a.tmp" ); while (<C>) { $count = $_; } print "$a is $count"; open( A,"$mon_file" ) || dIE "$!\n"; $i = 0; $num = 0; while (<A>) { $num++; if ( $_ =~ /$a/i ) { $i++; $b = $num } } print "$b is $b\n"; if ( $i != 0 && $i != $count && defined($count) ) { open( B,"$mon_file" ) || dIE "$!\n"; while (<B>) { chomp($_); push( @err_info,$_ ) if ( $. >= $b + 1 and $. <= $b + 2 ); } print "\@err_info is @err_info\n"; system("SMSsendx 111111111 \"@err_info\" 10.10.10.10"); } open( C,">","$a.tmp" ); print C ("$i\n");}总结
以上是内存溢出为你收集整理的Perl 调用短信全部内容,希望文章能够帮你解决Perl 调用短信所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)