help with email to be triggered based on fatal error detection from batch run log file neded

Hi,

I require need help in two aspects actually:

1) Fatal error that gets generated as %F% from a log file say ABClog.dat to trigger a mail. At present I manually grep the log file as <grep %F% ABClog.dat| cut-d "%" -f1>. The idea is to use this same logic to grep the log file which is present in $ABC_log directory.

2) How to create a mail that can be triggered. As far as I know the mailing abilities are enabled.

I use PUTTY to access the unix environment (maintained in solaris), and use a generalized login username (eg: f00_mgr). If the script can be run from $HOME to get the fatal error's and mail it would be great. I am kind of very new to the scripting in Unix so any help in sample codes or even the whole would be highly appreciated.

Thanks in advance

Regards
Abhradip Choudhuri

You can try this:

#!/usr/bin/ksh
mRC=$(grep -c '%F%' ABClog.dat)
if [[ "${mRC}" != "0" ]]; then
  <send your mail here>
fi