coldfusion – Check health of scheduled tasks? – Education Career Blog

We recently had an issue where a ColdFusion scheduled task didn’t resume after a Windows upgrade and a CF server restart. Is there a way to monitor the health of scheduled tasks and be alerted if they are not running properly? Or would I need to write a task to parse the log files for that information?


you can use the admin api to get information on your scheduled tasks. the following returns an array of structures with info about each scheduled task. you can then loop through the array and look at the last_run variable.

<cfset arySchedTasks = createobject("java","coldfusion.server.ServiceFactory").getCronService().listall() />


If you want to check that scheduled tasks are working at the most general level, one way is to schedule a “heartbeat” task, running as frequently as you wish. Set the task to update a counter, change a timestamp, send an email, trigger an “I’m alive” SMS every morning, add a log entry — whatever makes sense. This won’t tell you that all your tasks are running, but it will tell you that the server is alive, and the scheduled task system itself is working.

Another option is to funnel your tasks through a single point of entry — a sort of front-controller for tasks. This delegates the setup and configuration of individual tasks to your code, rather than the CF Administrator. Your master task controller would include triggering code for each task. Schedule the controller to run at as frequently as needed — so, one single task, rather than many. In the controller, something like this, perhaps every five minutes:

Check the time/date, compare against set of tasks
If time (or frequency) is A, run tasks P,Q,R, log success/failure
If time is B, run tasks S,T, log success/failure
If time is C, run tasks U,V,X, log success/failure    
Send heartbeat with success/failure codes for all relevant tasks

One advantage to this approach is that you can express much richer go/no-go workflows — have tasks run at semi-randomized frequencies, run tasks based on the success or failure of other tasks, etc. If you see/receive the heartbeat indicator, you know your task controller did in fact run.


Another simple option. Enable the output file for each task and check these files by independent Cron job: if file was changed within required time span should mean that scheduler task was executed.

Leave a Comment