Cold Fusion Where do place the code for cfschedule?

Viewed 255

I want to set up a simple scheduled task in ColdFusion. I will not have access to the Administrator. So I plan to use<cfschedule. The web is teeming with examples of how to write a cfschedule tag. But I cannot find any explanation of where to put the code.

Do I place it on any .cfm page? Must it go in the index.cfm or Application.cfm? Or what?

I also could not find any explanation of how the scheduling code is initiated. Is it sufficient that the cfschedule code should be somewhere in the application? And if not, what should I do to make sure it runs.

These questions feel stupid to me, but I just can't find answers. Can anyone enlighten me?.cfm

1 Answers

Off the top of my head I didn't know, so I googled cfschedule example and looked at this page.

The first example was to create or update a task. It says, tell ColdFusion to run 'importData.cfm' daily at 7AM

<cfschedule
 action="update"
 task="importMyCSVFileToDB"
 operation="HTTPRequest"
 startDate="5/12/2016"
 startTime="7:00 AM"
 url="http://www.example.com/scheduled/importData.cfm"
 interval="daily" />

My interpretation of that is that you put a <cfschedule> tag with a action="update" attribute on a page on the relevant server, and run it once. If it was me, I'd make it page with only the <cfschedule> tag followed by the word, done.

To test this theory, write a page that sends you a simple email. Then schedule that page as I just described and see if you get the email at the scheduled time.

Related