Shell Script to continuously scan a log file

Hello members,

I have some doubts on how to write a script that can reports success / failure of a batch job ?

  1. Run a batch job:

  2. Wait and search for a particular string in the Log file:

tail -f log01*.txt | egrep -v "^SUCCESSFUL" 
   echo "continue with the other tasks"
   elsif
     tail -f log01*.txt | egrep -v "^FAILURE"
   echo "Process failed!!"

My questions are :

  1. My batch job is likely to create a couple of logs with of type log01*.txt. How do I ensure the script scans through each of those logs to find either of the strings? I'm assuming the '*' can help me with this.

  2. Do I continuously scan the log file ( that might still be in the "generation" state ) or wait until the logfile is created completely and then scan for a string ? In this case, how does the script detect that a particular log file has generated successfully, so that it can search for a string ?

Regards

Kris

Maybe this is an alternative for you -> Swatch