# CFSCHEDULE

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 allows you to 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.

ColdFusion scheduled events are registered using the ColdFusion Administrator. In addition, execution of CFSCHEDULE can be disabled in the Administrator. Information supplied by the user includes the scheduled ColdFusion page to execute, the time and frequency for executing the page, and if the output from the task should be published. If the output is to be published then a path and file is specified.

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

### Syntax

    <CFSCHEDULE ACTION="Update"
        TASK="taskname"
        OPERATION="HTTPRequest"
        FILE="filename"
        PATH="path_to_file"
        STARTDATE="date"
        STARTTIME="time"
        URL="URL"
        PUBLISH="Yes/No"
        ENDDATE="date"
        ENDTIME="time"
        INTERVAL="seconds"
        REQUESTTIMEOUT="seconds"
        USERNAME="username"
        PASSWORD="password"
        RESOLVEURL="Yes/No"
        PROXYSERVER="hostname"
        PORT="port_number"
        PROXYPORT="port_number"
    >

    <CFSCHEDULE ACTION="Delete" TASK="TaskName">
    <CFSCHEDULE ACTION="Run" TASK="TaskName">

#### ACTION

Required. Valid entries are:

- Delete - Deletes task specified by TASK.
- Update - Creates a new task if one does not exist.
- Run - Executes task specified by TASK.

#### TASK

Required. The name of the task to delete, update, or run.

#### OPERATION

Required when creating tasks with ACTION="Update". Specify the type of operation the scheduler should perform when executing this task. For now only OPERATION="HTTPRequest" is supported for static page generation.

#### FILE

Required with PUBLISH="Yes." A valid filename for the published file.

#### PATH

Required with PUBLISH="Yes." The path location for the published file.

#### STARTDATE

Required when ACTION="Update". The date when scheduling of the task should start.

#### STARTTIME

Required when creating tasks with ACTION="Update". Enter a value in seconds. The time when scheduling of the task should start.

#### URL

Required when ACTION="Update". The URL to be executed.

#### PUBLISH

Optional. Yes or No. Specifies whether the result should be saved to a file.

#### ENDDATE

Optional. The date when the scheduled task should end.

#### ENDTIME

Optional. The time when the scheduled task should end. Enter a value in seconds.

#### INTERVAL

Required when creating tasks with ACTION="Update". Interval at which task should be scheduled. Can be set in seconds or as Once, Daily, Weekly, Monthly, and Execute. The default interval is one hour and the minimum interval is one minute.

#### REQUESTTIMEOUT

Optional. Customizes the REQUESTTIMEOUT for the task operation. Can be used to extend the default timeout for operations that require more time to execute.

#### 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. Yes or No. Specifies whether to resolve links in the result page to absolute references.

#### PORT

Optional. 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.

#### PROXYPORT

Optional. 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.

Note | You cannot use CFSCHEDULE and apply the Secure Sockets Layer (SSL) to your application.

### Example

    <!--- This example shows an example of CFSCHEDULE --->
    <HTML>
    <HEAD>
    <TITLE>CFSCHEDULE Example</TITLE>
    </HEAD>

    <BODY>
    <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 allows you to 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.

    <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">
    </BODY>
    </HTML>