Provides a programmatic interface to the ColdFusion scheduling engine. Can run a CFML page at scheduled intervals, with the option to write the page output to a static HTML page. This feature enables you to schedule pages that publish data, such as reports, without waiting while a database transaction is performed to populate the page.
<cfschedule
action = "update"
task = "taskname"
operation = "HTTPRequest"
file = "filename"
path = "path_to_file"
startDate = "date"
startTime = "time"
url = "URL"
port = "port_number"
publish = "yes" or "no"
endDate = "date"
endTime = "time"
interval = "seconds"
requestTimeOut = "seconds"
username = "username"
password = "password"
proxyServer = "hostname"
proxyPort = "port_number">
proxyUser = "username"
proxyPassword = "password"
resolveURL = "yes" or "no"
<cfschedule
action = "delete"
task = "TaskName">
<cfschedule
action = "run"
task = "TaskName">
cfcookie, cfparam, cfregistry, cfsavecontent, cfset
ColdFusion MX 6.1: Changed the way intervals are calculated. The day length now reflects changes between standard and daylight saving times. The month length is now the calendar month length, not four weeks. The scheduler handles leap years correctly.
Attribute | Req/Opt | Default | Description |
---|---|---|---|
action |
Required |
|
|
task |
Required |
|
Name of the task. |
operation |
Required if |
|
Operation that the scheduler performs. Must be |
file |
Required if |
|
Name of the file in which to store the published output of the scheduled task. |
path |
Required if |
|
Path to the directory in which to put the published file. |
startDate |
Required if |
|
Date on which to first run the scheduled task. |
startTime |
Required if |
|
Time at which to run the scheduled of task starts. |
url |
Required if |
|
URL of the page to execute. |
port |
Optional |
80 |
Port to use on the server that is specified by the |
publish |
Optional |
No |
|
endDate |
Optional |
|
Date when scheduled task ends. |
endTime |
Optional |
|
Time when scheduled task ends (seconds). |
interval |
Required if |
|
Interval at which task is scheduled:
|
requestTimeOut |
Optional |
|
Can be used to extend the default timeout period. |
username |
Optional |
|
Username, if URL is protected. |
password |
Optional |
|
Password, if URL is protected. |
proxyServer |
Optional |
|
Host name or IP address of a proxy server. |
proxyPort |
Optional |
80 |
Port number to use on the proxy server. |
proxyUser |
Opt |
|
User name to provide to the proxy server. |
proxyPassword |
Opt |
|
Password to provide to the proxy server. |
resolveURL |
Optional |
No |
|
This tag and the ColdFusion MX Administrator Scheduled task page schedule ColdFusion tasks. Tasks that you add or change using this tag are visible in the Administrator. You can disable this tag in the Administrator Sandbox/Resource security page. This tag's success or failure status is written to the schedule.log file in the cf_root/logs directory (cf_webapp_root/WEB-INF/cfusion/logs in the multiserver and J2EE configurations).
When you create a task, you specify the URL of the ColdFusion page to execute, the date, time and frequency of execution, and whether to publish the task output to a HTML file. If the output is published, you specify the output file path and file.
If you schedule a job to run monthly on any date in the range 28-31, the scheduler does the following:
If you schedule a job to run once, the starting time is in the past, and the task has not yet run, it runs immediately. 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.
<h3>cfschedule Example</h3> <!--- This read-only example schedules a task. To run the example, remove the comments around the code and change the startDate, startTime, url, file, and path attributes to appropriate values. ---> <!--- <cfschedule action = "update" task = "TaskName" operation = "HTTPRequest" url = "http://127.0.0.1/playpen/history.cfm" startDate = "8/7/03" startTime = "12:25 PM" interval = "3600" resolveURL = "Yes" publish = "Yes" file = "sample.html" path = "c:\inetpub\wwwroot\playpen" requestTimeOut = "600"> --->