<cfschedule>
Provides a programmatic interface to the 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 in order to populate the data on the page.
Scheduled Tasks - efficiently updating in a single operation
This tag cannot have a body.
This tag is also supported within <cfscript>
<cfschedule
action=delete|run|update|list|resume|pause
serverPassword=string
hidden=boolean
readonly=boolean
task=string
operation=string
paused=boolean
file=string
path=string
startDate=any
startTime=any
url=string
publish=boolean
endDate=any
endTime=any
interval=string
requestTimeOut=any
username=string
password=string
proxyServer=string
proxyUser=string
proxyPassword=string
userAgent=string
resolveURL=boolean
port=any
proxyPort=any
result=string
autoDelete=boolean
unique=boolean
>
| Attribute | Description |
|---|---|
|
action
string, required
|
edit
|
|
operation
string, optional
|
edit
The type of operation the scheduler performs when executing this task.
|
Create/Update Task
action="update" - Create or update a scheduled task
| Attribute | Description |
|---|---|
|
task
string, optional
|
edit
The name of the task to delete, update, or run. |
|
url
string, optional
|
edit
Required when action = 'update'. The URL to be executed. |
|
startDate
any, optional
|
edit
Required when action ='update'. The date when scheduling of the task should start. |
|
startTime
any, optional
|
edit
Required when creating tasks with action = 'update'. Enter a value in seconds. The time when scheduling of the task starts. |
|
interval
string, optional
|
edit
Required when creating tasks with action= Interval at which task should be scheduled. Can be defined in seconds or as
The default interval is one hour. The minimum interval is 10 seconds. |
|
endDate
any, optional
|
edit
The date when the scheduled task ends. |
|
endTime
any, optional
|
edit
The time when the scheduled task ends. Enter a value in seconds. |
|
publish
boolean, optional
|
edit
Specifies whether the result should be saved to a file. |
|
file
string, optional
|
edit
Required with publish ='Yes' A valid filename for the published file. |
|
path
string, optional
|
edit
Required with publish ='Yes' The path location for the published file. |
|
requestTimeOut
any, optional
|
edit
Customizes the requestTimeOut for the task operation. Can be used to extend the default timeout for operations that require more time to execute. Value in seconds. |
|
username
string, optional
|
edit
Username if URL is protected. |
|
password
string, optional
|
edit
Password if URL is protected. |
|
proxyServer
string, optional
|
edit
Host name or IP address of a proxy server. |
|
proxyPort
any, optional
|
edit
The port number on the proxy server from which the task is being requested. Default is 80. When used with resolveURL, the URLs of retrieved documents that specify a port number are automatically resolved to preserve links in the retrieved document. |
|
proxyUser
string, optional
|
edit
User name to provide to the proxy server. |
|
proxyPassword
string, optional
|
edit
Password to provide to the proxy server. |
|
userAgent
string, optional
|
edit
User agent request header. Introduced: 6.0.0.172 |
|
resolveURL
boolean, optional
|
edit
Specifies whether to resolve links in the result page to absolute references. |
|
port
any, optional
|
edit
The port number on the server from which the task is being scheduled. Default is 80. When used with resolveURL, the URLs of retrieved documents that specify a port number are automatically resolved to preserve links in the retrieved document. |
|
paused
boolean, optional
|
edit
if set to true the scheduled task is paused. |
| boolean, optional |
edit
if set to true the scheduled task is not displayed in the Lucee Administrator. |
|
readonly
boolean, optional
|
edit
if set to true the scheduled task can not be modified or deleted in the Lucee Administrator. |
|
autoDelete
boolean, optional
|
edit
if set to true, the scheduled task get deleted when there is no possible future execution. |
|
unique
boolean, optional
|
edit
if set to true, the scheduled task is only executed once at time.if a task is still running from previous round no new task is started. |
|
serverPassword
string, optional
|
edit
allow you to access filesystem, also when access is denied for your context |
Run Task
action="run" - Execute a scheduled task immediately
| Attribute | Description |
|---|---|
|
task
string, optional
|
edit
The name of the task to delete, update, or run. |
Delete Task
action="delete" - Remove a scheduled task
| Attribute | Description |
|---|---|
|
task
string, optional
|
edit
The name of the task to delete, update, or run. |
List Tasks
action="list" - Get all scheduled tasks
| Attribute | Description |
|---|---|
|
result
string, optional
|
edit
Return variable name of action list. Result attribute doesn't work with other actions. Alias: returnvariable |
Pause Task
action="pause" - Pause execution of a scheduled task
| Attribute | Description |
|---|---|
|
task
string, optional
|
edit
The name of the task to delete, update, or run. |
Resume Task
action="resume" - Resume execution of a paused task
| Attribute | Description |
|---|---|
|
task
string, optional
|
edit
The name of the task to delete, update, or run. |
Examples
editSyntax for cfschedule
<cfschedule
action="update"
task="test"
operation="HTTPRequest"
startDate="6/02/2019"
startTime="12:00 AM"
url="https://www.test.com/schedule_task/test.cfm"
interval="daily"
publish = "Yes"
file = "myfile.log"
path = "#expandPath('./')#" />
Action List
<cfschedule action="list" returnvariable="res">
Action Run
<cfschedule action="run" task="taskOne">
Action Pause
<cfschedule action="pause" task="taskOne">
Action Resume
<cfschedule action="resume" task="taskOne">
Action Delete
<cfschedule action="delete" task="taskOne">