vendredi 16 décembre 2016

Finding Strings on the text file - Batch file

I would like to ask if how can I find strings (3 or 5 words) on the text file with conditions. If the strings was found then a certain variable will become equal to 1.

Scenario

I have a batch file will run every 12:01 AM. This batch file have multiple commands inside. Please see below:

  1. Tail logger
  2. Log checker
  3. Restarter

Tail logger - This was the first function will run on the batch file. It will tail log the server and put the logs on a server.log and create another log file that will have the last 2 lines of the logs (temp.log)

Log Checker - After the tail logger, This function will run and will find the a certain words on the temp.log.

Example:

This will find a strings "The task complete" if the checker find this it will make a variable from set X=0 to set X=1.

Thanks.

Aucun commentaire:

Enregistrer un commentaire