Hi,
We are trying to send an email if a job didn't run in the last one hour.
I tried to print the instances of the job which ran in last one hour using the below method, but it is printing all the instances of the job which ran till now from the time it was scheduled to run. Please advise.
DateTimeZone t = new DateTimeZone();
t.setNow();
long currtime = t.getUTCMilliSecs();
long lngDuration=0;
String strSql= "select j.* from Job j, JobDefinition jd where j.JobDefinition = jd.UniqueId and jd.Name = 'REDWOOD_TEST' and j.RunEnd < NOW('subtract 60 minutes')";
Iterator it = jcsSession.executeObjectQuery(strSql, null);
while (it.hasNext())
{
Job j = (Job) it.next();
if (j.getRunEnd()!= null && j.getStatus()!= null)
{
lngDuration=currtime - j.getRunEnd().getUTCMilliSecs();
jcsOut.println(j.getStatus() + " " + j.getRunEnd()+ " " + lngDuration);
}
else
{
// Put the email code here
}
Regards,
Tinku