Find out running job on Unix is successful or unsuccessful

Hi Team,

I’m new to scripting and preparing a small script to check if one of the job is successful on the unix machine.
If the job is successful on the particular day (previous day than today) script should return value one else it should return value zero.

I’ve written below plain statement so far, need to put this in a script which can take the system date does -1 to the system date (previous than the runday) and then pass that date as input to below string.

grep ‘Operational Job ended successfully on’ JOBNAME_JOBREC(DATE in format of YYYYMMDD)* | wc -l

Can someone help here ?

Use GNU date to find out yesterday’s date:

date +"%Y%m%d" --date="yesterday"


grep 'Operational Job ended successfully on' JOBNAME_JOBREC$(date +"%Y%m%d" --date="yesterday")* | wc -l