View comments | RSS feed
Contents > CFML Reference > ColdFusion Tags > cfschedule PreviousNext

cfschedule

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.

Variable manipulation tags

<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">

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.

cfcookie, cfparam, cfregistry, cfsavecontent, cfset

Attribute

Req/Opt

Default

Description

action

Required

 

  • delete: deletes the specified task
  • update: updates an existing task or creates a new task, if one with the name specified by the task attribute does not exist
  • run: executes the specified task

task

Required

 

Name of the task.

operation

Required if action = "update"

 

Operation that the scheduler performs. Must be HTTPRequest.

file

Required if publish = "Yes"

 

Name of the file in which to store the published output of the scheuled task.

path

Required if publish = "Yes"

 

Path to the directory in which to put the published file.

startDate

Required if action = "update"

 

Date on which to first run the scheuled task.

startTime

Required if action = "update"

 

Time at which to run the scheduled of task starts.

url

Required if action = "update"

 

URL of the page to execute.

port

Optional

80

Port to use on the server that is specified by the url parameter. If resolveURL = "yes", retrieved document URLs that specify a port number are automatically resolved, to preserve links in the retrieved document. A port value in the url attribute overrides this value.

publish

Optional

No

  • Yes: save the result to a file
  • No

endDate

Optional

 

Date when scheduled task ends.

endTime

Optional

 

Time when scheduled task ends (seconds).

interval

Required if action = "update"

One hour

Interval at which task is scheduled.

  • number of seconds (minimum is 60)
  • once
  • daily
  • weekly
  • monthly

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

  • Yes: resolve links in the output page to absolute references
  • 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 Aministrator. You can disable this tag in the Administrator Sandbox/Resource security page. This tag's success or failure status is written to the \cfusion\log\schedule.log file.

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 ouptupt 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 approprate 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">
--->

Contents > CFML Reference > ColdFusion Tags > cfschedule PreviousNext

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

Comments


No screen name said on Jan 9, 2004 at 5:30 AM :
I don't understand the correct value for option StartDate and StartTime.

For the StartDate i suppose i have to use the format: mm/dd/yyyy
For the StartTime can anyone confirm to use the format: hh:mmtt ?

Please help me on this configuration because my scheduling don't work well.

Thanks,

Davide Rossi (drossi@contechnet.it)
s22 said on Apr 5, 2004 at 12:15 AM :
user "hh:mm Am"or "hh:mm Pm" format for the StartTime
Normeeee said on Jul 23, 2004 at 9:12 AM :
How can I make the FILE value dynamic with the today's date, like 070104.html, 070204.html, 070304.html, ...

Thanks
nick451 said on Aug 19, 2004 at 11:30 AM :
<interval> does not specify a maximum number of seconds. For example, would it support a value of 1209600 to accomplish an interval of 2 weeks?
MikerRoo said on Oct 26, 2004 at 7:33 PM :
"scheuled" seems to be misspelled a few times in the docs.
MikerRoo said on Oct 26, 2004 at 9:44 PM :
Path seems to need a trailing slash to always work correctly.
That is:
When path = "c:ogs" and File = "#variableFileName#", the output file will sometimes be "C:ogs\FilenameA" and sometimes be "C:ogsFilenameB".
ApproachingLinux said on Nov 24, 2004 at 10:26 AM :
Will "action=delete" kill a currently executing task ?
If not, is it possible to do so ?
dorange said on Dec 11, 2004 at 10:20 AM :
I agree with MikerRoo , one needs a trailing slash (at least on Windows) in path attribute.

Also my opinion is that cfschedule and scheduling engine in general is not described in enough detail. For example, can one use relative path in path attribute? If so relative to what? What happens to a currently running (or recurring but not currently running) task when one updates it with new parameters? i.e. when do the changes kick in> Does "once" type task run immediately and then disappears from Taks list in Administrator or does it linger on? etc. etc..
No screen name said on Jan 3, 2005 at 9:52 AM :
Somehow a task got scheduled with a name that has some strange characters at the end, possibly a carriage return. I cannot delete it in the Administrator ofr cfschedule. How can I manually delete it?

Thanks
No screen name said on Jan 26, 2005 at 10:45 PM :
What I want to know is can you pass a URL variable in the URL parameter in order to pass it to the launching page when Scheduler launches. Such as:

</cfquery>
<CFSCHEDULE
ACTION=”UPDATE”
TASK=”Schedule Emails to #FORM.key#”
OPERATION=”HTTPRequest”
URL=”/tasks/scheduler.cfm?key=#key#”
STARTDATE=”#billdate#”
STARTTIME=”4:30:00 AM”
INTERVAL=”Monthly”
ECKHART said on Oct 10, 2005 at 5:19 AM :
I want to know if cfschedule throws any errors if it can't initiate the task. I see no documentation about return values, or errors thrown. Is there a way to determine the fate of the scheduled task? tia.
ASandstrom said on Oct 18, 2005 at 11:26 AM :
The scheduler.log file provdes information about scheduled tasks. See:
http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/basico28.htm
for a list of log files.
jsaun said on Oct 26, 2005 at 4:55 PM :
To remove a scheduled job the hard way, edit neo-cron.xml directly.
It's can be found (in the J2EE deployment of Cold Fusion) in \cfusion-ear\cfusion-war\WEB-INF\cfusionib

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-a30.htm