noviceuser has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to grep FAIL from a log file and sending mail in case there is any occurence of FAIL in the log, but i am getting below syntax error. Please help
Reason - syntax error at ./aakash_script.pl line 21, near "'FAIL' $logFile"
my $status = 0; my $logFile = "/icd/rc/genus22/logs/genus_221/v22.10-d037/lnx86_64_opt +/1/tamper.log"; if (-e $logFile) { $status = grep ': FAIL' $logFile; sendMail("kaakash", "Check Tamper Test failed", "C +heck tamper test failed.", "xyz") if ($status != 0); $status ++ ; } else { $status ++; sendMail("kaakash", "Check Tamper Test failed:", "$logFile + not found.", "xyz"); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to grep from a log file
by choroba (Cardinal) on Jul 07, 2021 at 10:58 UTC | |
|
Re: how to grep from a log file
by haukex (Archbishop) on Jul 07, 2021 at 10:52 UTC | |
|
Re: how to grep from a log file
by afoken (Chancellor) on Jul 07, 2021 at 10:57 UTC | |
|
Re: how to grep from a log file
by Marshall (Canon) on Jul 08, 2021 at 21:40 UTC |