View comments | RSS feed

cfschedule

Description

Provides a programmatic interface to the ColdFusion scheduling engine. You can run a page at scheduled intervals, with the option to write out static HTML pages. This lets users access pages that publish data, such as reports, without waiting while a database transaction is performed to populate the page.

You register ColdFusion scheduled events in the ColdFusion Administrator. You can disable cfschedule execution in the Administrator.

Information that the user supplies includes the scheduled ColdFusion page to execute, the time and frequency of execution, and whether to publish the task output. If the output is published, a path and file are specified.

The event submission and its success or failure status is written to the \cfusion\log\schedule.log file.

Category

Variable manipulation tags

Syntax

<cfschedule 
  action = "update"
  task = "taskname"
  operation = "HTTPRequest"
  file = "filename"
  path = "path_to_file"
  startDate = "date"
  startTime = "time"
  url = "URL"
  publish = "Yes" or "No"
  endDate = "date"
  endTime = "time"
  interval = "seconds"
  requestTimeOut = "seconds"
  username = "username"
  password = "password"
  resolveURL = "Yes" or "No"
  proxyServer = "hostname"
  port = "port_number"
  proxyPort = "port_number">

<cfschedule 
  action = "delete" 
  task = "TaskName">

<cfschedule 
  action = "run" 
  task = "TaskName">

See also

cfcookie, cfparam, cfregistry, cfsavecontent, cfset

Attributes

Attribute Req/Opt Default Description
action
Required

  • delete: deletes task
  • update: creates task, if one does not exist
  • run: executes task
task
Required

Name of task.
operation
Required if action = "update"

Task that scheduler performs. For static page generation, the only option is "HTTPRequest".
file
Required if publish = "Yes"

Filename for the published file.
path
Required if publish = "Yes"

Path location for the published file.
startDate
Required if action = "update"

Date when task scheduling starts.
startTime
Required if action = "update"

Time when scheduling of task starts (seconds).
url
Required if action = "update"

URL to execute.
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.
resolveURL
Optional
No
  • Yes: resolve links in result page to absolute references
  • No
port
Optional
80
Server port number from which the task is scheduled. IF resolveURL= "yes", retrieved document URLs that specify a port number are automatically resolved, to preserve links in the retrieved document.
proxyPort
Optional
80
Port number on proxy server from which task is requested. When used with resolveURL, URLs of retrieved documents that specify a port number are automatically resolved, to preserve links in retrieved document.

Usage

You cannot use cfschedule and apply Secure Sockets Layer (SSL) to an application.

Example

<h3>cfschedule Example</h3>
<p>cfschedule provides a programmatic interface to the ColdFusion scheduling
engine. You can run a specified page at scheduled intervals with the
option to write out static HTML pages. This lets you offer users access 
to pages that publish data, such as reports, without forcing users to
wait while a database transaction is performed to populate the data 
on the page.
<p>View-only-example</p>
<cfschedule action = "update"
  task = "TaskName" 
  operation = "HTTPRequest"
  url = "http://127.0.0.1/playpen/history.cfm"
  startDate = "8/7/98"
  startTime = "12:25 PM"
  interval = "3600"
  resolveURL = "Yes"
  publish = "Yes"
  file = "sample.html"
  path = "c:\inetpub\wwwroot\playpen"
  requestTimeOut = "600">

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

Version 6

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

Comments


Steve said on Apr 1, 2004 at 7:30 PM :
In CF5 the publish attribute needs to have a value of either 1 or 0. It treats the value 'Yes' like a 0. You can test this by using the cfschedule tag with publish="yes" then go into the CFIDE and see if the Save output to a file checkbox is checked. It won't be. But if you set it to publish="1" then the Save output to a file is checked.

This doesn't seem to be a problem in CFMX.
TomGru said on Apr 25, 2005 at 12:15 AM :
There seemd to be a Bug with the Scheduled Tasks on the Coldfusion MX 6 Enterprise Edition. I run a Scheduled Task daily at 8:30 AM and the Script which is exicuted send me a email after successful execution. The first day the Task work fine but from day 2 on the Scheduled Task is executed at 0:01 AM !!! It seems from day 2 on the Task looses the Execution Time. I've tried it several times with various execution Times. Same thing. On Start Date everything works fine, the days after it set back the execution time to 0:00 as if the were no execution time.
TomGru said on Apr 25, 2005 at 12:55 AM :
The Scheduled Tasks is a known Bug and is adressed here: http://www.macromedia.com/cfusion/knowledgebase/index.cfm?search_text=Scheduled+Tasks&loc=en_US&event=search&product=SG_ColdFusion&action=Search

 

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

Current page: http://livedocs.adobe.com/coldfusion/6/CFML_Reference/Tags-pt229.htm