Besides being able to
schedule tasks with the ColdFusion Administrator, you can use the
CFSCHEDULE tag to do it programmatically. With the
CFSCHEDULE tag, you can add, update, delete, and
run scheduled tasks. Scheduling tasks programmatically let’s
you add a whole new level of functionality to your applications. For
example, you can create a reporting application that allows users to
have automatic email delivery of their reports on a scheduled basis.
CFSCHEDULE tag, it is easy to set things
up so that your application automatically schedules a task for each
user. And each task can automatically generate a report and email it
to the user at a chosen interval.
The attributes used by the
CFSCHEDULE tag roughly
coincide with the form fields from the Add Scheduler Task page in the
ColdFusion Administrator, as you can see in Appendix A.
a task to the Scheduler using
CFSCHEDULE is a lot
like adding a task via the ColdFusion Administrator. The information
you enter in the ColdFusion Administrator is the same information you
specify for the
CFSCHEDULE tag attributes. For
example, to schedule a task called
calls the template located at http://www.example.com/myscript.cfm once a
day at 1:30 p.m., you can use the following code:
<CFSCHEDULE ACTION="Update" TASK="MyTask" OPERATION="HTTPRequest" URL="http://www.example.com/myscript.cfm" STARTDATE="#DateFormat(Now( ),'mm/dd/yyyy')#" STARTTIME="13:30:00" INTERVAL="Daily" ...