DevLearningTools

MODULE 13 · LESSON 18

<cfschedule>

Scheduling a recurring task with cfschedule: creating, pausing, and listing tasks, publishing output to a static file, and a real Lucee 7+ packaging gotcha that mirrors mail, PDF, chart, and image extensions.

New lessons are added one at a time as the course gets built out — a graded quiz for each lesson is still on the way.

cfschedule automates running a page on a recurring schedule, generating a report, syncing data, cleaning up old records, without needing an external OS-level cron job. It manages the schedule itself: creating, pausing, resuming, and listing tasks entirely from CFML.

Learning Objectives

After completing this lesson, you'll be able to:

  • Schedule a task to run on a recurring interval.
  • Publish a scheduled task's output to a static file.
  • Pause, resume, and list scheduled tasks.
  • Recognize a real Lucee 7+ packaging gotcha shared with several other tags in this module.

How cfschedule Fits In

action="update" Registers the Task

Scheduler Fires at startTime / interval

url Is Requested

Optionally Published to a Static File

A Basic Daily Task

Tag Syntax
<cfschedule
    action="update"
    task="dailyCleanup"
    url="https://example.com/tasks/cleanup.cfm"
    startDate="2026-01-01"
    startTime="02:00 AM"
    interval="Daily">

cfschedule's Attributes

AttributeMeaning
taskThe task's name (required except for action="list")
urlThe page to request when the task runs
operationHTTPRequest, the only supported value
startDate / startTimeWhen the schedule begins
intervalOnce, Daily, Weekly, Monthly, or a number of seconds (minimum 10)
endDate / endTimeWhen the schedule stops
publish / file / pathWhether to save the task's output to a static file, and where
portDefaults to 80
groupOrganizes related tasks (ColdFusion 11+)
retryCount / priorityResilience and ordering (ColdFusion 10+, retryCount 0–3, default 3)
NOTE

Adobe's documentation also shows an example scheduling a task with a cron-style expression for more complex recurring patterns, beyond the fixed interval values.

The Actions

actionDoes
update / create / modifyCreates or changes a scheduled task
deleteRemoves a scheduled task
runExecutes a task immediately, outside its normal schedule
pause / resumeStops or restarts a specific task
pauseAll / resumeAllStops or restarts every scheduled task
listReturns a query of every scheduled task

A Real Example: Publishing a Report to a Static File

This is a genuinely common real use case: pre-generating an expensive report on a schedule so visitors get an instant static file instead of waiting on database queries with every request.

Tag Syntax
<cfschedule
    action="update"
    task="nightlySalesReport"
    url="https://example.com/reports/sales-report.cfm"
    startDate="2026-01-01"
    startTime="01:00 AM"
    interval="Daily"
    publish="true"
    file="sales-report.html"
    path="#expandPath('./public-reports/')#">

A Real Example: Pausing, Resuming, and Listing Tasks

Tag Syntax
<cfschedule action="pause" task="nightlySalesReport">
<cfschedule action="resume" task="nightlySalesReport">
<cfschedule action="list" name="allTasks">

A Real Lucee 7+ Gotcha: Scheduler Classic Extension

Lucee's documentation notes that as of Lucee 7+, the traditional scheduled-task system moved to a separate Scheduler Classic extension, it's no longer bundled by default, and Lucee points toward its own Quartz Scheduler as the modern alternative when clustering support matters.

NOTE

This is the same pattern seen across this module for cfmail, cfimap, cfpop, cfdocument, cfpdf, and cfchart, Lucee 7 consistently moved several traditionally-bundled subsystems into separate extensions.

A Real Difference: Fewer Documented Actions on Lucee

NOTE

Lucee's own reference documents only update, delete, run, list, pause, and resume, create and modify aren't listed separately (update covers both), and pauseAll/resumeAll aren't documented at all.

Common Beginner Mistakes

Expecting operation to support anything other than an HTTP request

HTTPRequest is the only supported value, cfschedule triggers a URL, it doesn't directly invoke a CFC method or arbitrary function.

Setting publish=true without file and path

Both are required together with publish=true, without them there's nowhere for the generated output to actually be saved.

Assuming pauseAll/resumeAll exist on Lucee

They aren't documented there, only individual task-level pause/resume are confirmed.

Assuming Lucee's scheduler works out of the box on Lucee 7+

The traditional scheduled-task system moved to the separate Scheduler Classic extension, it needs to be installed explicitly.

Best Practices

  • Publish an expensive report to a static file on a schedule, rather than making every visitor wait on the same database query.
  • Use group (ColdFusion 11+) to organize related scheduled tasks together.
  • Use retryCount and priority (ColdFusion 10+) for resilience against a transient failure.
  • Use action="list" periodically to audit exactly what's actually scheduled on a server, rather than relying on memory.

Interview Questions

What's the only supported value for cfschedule's operation attribute?

HTTPRequest, cfschedule triggers a URL request, not a direct function or CFC method call.

Why would you use publish/file/path on a scheduled task?

To pre-generate expensive output (like a report) on a schedule and save it as a static file, so real visitors get an instant response instead of waiting on the underlying database work with every request.

What changed about Lucee's scheduler in Lucee 7+?

The traditional scheduled-task system moved to a separate Scheduler Classic extension, no longer bundled by default, with Lucee's own Quartz Scheduler offered as the modern alternative for clustering.

Summary

In this lesson, you scheduled a recurring task, published a report's output to a static file, paused/resumed/listed tasks, and covered Lucee 7+'s scheduler packaging change, the same extension-separation pattern seen across mail, PDF, chart, and image tags earlier in this module.

What's Next?

This completes Module 13 (Web Development). The next module moves into APIs and modern development, starting with REST API basics.