Notify if Job Has Not Run in Over 24 Hours - VisualCron - Forum

Community forum

MSchwartz
2020-09-15T19:31:07Z
Is there a way to send a notification if a job has not run in a certain period of time?

We have many jobs set up with file triggers, and we expect those jobs to run every day. If they do not run (e.g. the file didn't show up), we want to investigate to see if there's a problem.

Here's one way I know it can be done:

  1. Create a separate job triggered every day at 12am
  2. Add a Wait task to wait 9 hours (until 9am)
  3. Add an Email task to notify that the original job did not run
  4. In the original job, add a VisualCron task that stops this separate job from running

This way, the email task will only run when the original job does not run thus does not stop the separate job.

However, this would require us to create a separate Wait job for every processing job we have.

Is there a better, more efficient way for us to accomplish this?
thomas
2020-09-15T20:03:09Z
You can use the api for this, but I assume you know that. Using VisualCron only, I would try this:

Create a job, add a task of type Internal/Job report. Choose the jobs you want to include in this check:

image.png

Write to ouput or file, whichever you prefer

image.png

It generates output like this ( I added job name and last execution as report content)

image.png

Use this output to send mail based on the timestamp. It will require som additional logic ofcourse, but It shouldn't be to hard
bweston
2020-09-18T14:50:24Z
The job report approach is probably better, but I think at one point I had one set up so that in addition to the file trigger it had a time trigger to run once a day; the first task was a no-op, and the flow for it was...I've forgotten exactly how I set it up. I think it was "if the current execution is from the file trigger, continue. If the current execution is from a time trigger and the last time the file trigger triggered was over 24 hours ago, send a notification. If the current execution is from a time trigger, stop the job regardless."
MSchwartz
2020-09-18T16:00:51Z
Originally Posted by: thomas 

Create a job, add a task of type Internal/Job report. Choose the jobs you want to include in this check:
...
Use this output to send mail based on the timestamp. It will require som additional logic ofcourse, but It shouldn't be to hard


Originally Posted by: bweston 

If the current execution is from a time trigger and the last time the file trigger triggered was over 24 hours ago, send a notification.


That's the problem I'm running into. I don't see any way to tell VisualCron to do something if x date is older than y date. You can use < or > operators to compare numbers, but not strings like dates.
bweston
2020-09-18T16:42:29Z
Originally Posted by: MSchwartz 

Originally Posted by: thomas 

Create a job, add a task of type Internal/Job report. Choose the jobs you want to include in this check:
...
Use this output to send mail based on the timestamp. It will require som additional logic ofcourse, but It shouldn't be to hard


Originally Posted by: bweston 

If the current execution is from a time trigger and the last time the file trigger triggered was over 24 hours ago, send a notification.


That's the problem I'm running into. I don't see any way to tell VisualCron to do something if x date is older than y date. You can use < or > operators to compare numbers, but not strings like dates.



I did it by using "if other value" in the flow and wrapping the relevant date variable in something I could use to force it to the format yyyyMMddHHmmss I think. You can tell it to compare those as Int64. It may be necessary to tell it to add 0 days to a specified date to control the format that way, if I remember right, which gets very verbose, but it works.
Scroll to Top