我正在编写一个用perl编写的脚本,该脚本会对current_count的IP地址进行处理,并将其与预期的计数进行比较。
目前,如果当前计数==正常计数,则打印好单词...如果当前计数不等于正常计数,则打印单词bad并显示IP地址和当前计数。
我想要实现的目标是,如果当前计数不等于正常计数,那么就像现在一样在屏幕上打印坏词,但还要做两件事。
目前只在屏幕上打印时才有效:
while ..............{
next if $current_count{$ip_port} == $normal_count && print "ip_port is good";
print "$ip_port is bad- Need $normal_count, found only $current_count{$ip_port}\n";
如果计数错误,我尝试发送电子邮件提醒并执行stats.sh脚本:
while ..............{
next if $current_count{$ip_port} == $normal_count && print "ip_port is good \n";
print "$ip_port is bad- Need $normal_count, found only $current_count{$ip_port}
&&
my $body = "$ip_port is bad- Need $normal_count, found only $current_count{$ip_port}";
my $cmd_email = "echo $body | " .
"mailx -s \"Missing Counts" Frank.Robertson\@Yahoo.com";
system($cmd_email) == 0 or die "Error sending email -- $!";
&&
/home/roberston/stats.sh;
非常感谢任何帮助!
谢谢
答案 0 :(得分:-1)
numbertobeRound=58.8965896589;