The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 09-01-2008
senthilkumar_ak senthilkumar_ak is offline
Registered User
  
 

Join Date: Aug 2008
Location: Chennai
Posts: 43
Need logic for check automated Job work in awk or SED.

I have a Java program which will automatically trigger some scheduled job to update Db or some other work. I am tracking the jobs with log messages and finding out it is properly run or not. I want to write a script to capture it correctly on time.

Say Job1 is running on 15, 30, and 45 every hour then it leave an entry in the log file that “JOB1 is started”. Like this.

Example for hour 11:00 pm means –

Worker#Scheduler_Worker-3: 23:15:56 105 SendToCM: run() Entry

where “SendToCM: run() Entry” starting log message which Java program write in the log message, '23:15:56' is the time . I need to check the last hour 15 , 30, 45 min log files to find out the entry is their or not then I intimate via mail to me.

i have a logic but not tested yet. For 15 min I am checking with sed like this,

sed -n "/: $h:15:00/,/: $h:15:01/p" schedulerTrace .log > Job1.log

here $h contains the current hour and in the job1.log I’m checking again like

count=grep –c “SendToCM: run() Entry” Job1.log.

if count is zero then the JOB1 is not ran and I need to check exception.
But this logic is very oblique to me. Could you me please help me on finding out a correct logic for this.

Regards,
Senthilkumar.