Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get list of scheduled tasks and last run results in ColdFusion?

We're trying to build a dashboard for our cron jobs ---- CF, Java, SQLServer, etc. so that we can see when things were run last, what the result was, and when they're scheduled to run next.

Is there a way with the CFAdmin API or some undocumented <cfschedule> trick to get a list of:

  1. What tasks are scheduled?
  2. What the last run time was?
  3. Did it succeed?
  4. When is it scheduled to run again?

We're currently on CF8, but will be upgrading to CF9 within a few weeks.

like image 381
Chris Brandt Avatar asked Feb 23 '10 17:02

Chris Brandt


People also ask

Where are ColdFusion scheduled tasks stored?

If you schedule a recurring job with a start time in the past, ColdFusion schedules the job to run on the next closest interval in the future. The Scheduler configuration file, cf_root\lib\neo- cron . xml contains all scheduled events, as individual entries (except the clustered tasks).

How do I run a scheduled task from the command line?

View scheduled tasks At the command prompt, type the net start command, and then press ENTER to display a list of currently running services. At the command prompt, do one of the following steps: To view a list of tasks that you scheduled by using the at command, type the at \\computername line, and then press ENTER.


1 Answers

I did a little research into this for you. I found a somewhat older reference that is still valid, at least in CF8 and presumably in CF9 as well.

<cfobject type="JAVA" action="Create" name="factory" class="coldfusion.server.ServiceFactory">
<cfset allTasks = factory.CronService.listAll()/>
<cfloop index="i" from="1" to="#ArrayLen(allTasks)#">
    <cfdump var="#allTasks[i]#" />
</cfloop>

From http://www.bpurcell.org/blog/index.cfm?mode=entry&ENTRY=935

This answers your questions #1 and #4. As for #3, there can be no answer to that. ColdFusion's scheduled task engine is just loading up the specified URL at the prescribed time. There is no success or fail -- it simply performs an HTTP request.

Hope this helps.

like image 135
Eric Kolb Avatar answered Sep 22 '22 20:09

Eric Kolb