Reputation: 28483
I'm trying to setup my first Coldfusion scheduled task and can't get it to work. I don't have access to the cfadmin
so, I need to do it using the cfschedule
tag. I'm setting up something like this:
<cfschedule action = "update"
task = "taskManager"
operation = "HTTPRequest"
url = "path/to/task_manager.cfm"
startDate = "12/01/12"
startTime = "10:30 PM"
interval = "60"
resolveURL = "Yes"
publish = "No"
path = "#variables.baseUrl#"
requestTimeOut = "100">
Which I'm putting in task_init.cfm
. If I open this page in the browser, no errors are reported, but nothing happens.
Question:
I know scheduled tasks need to be allowed in CFAdmin. Still is there a way to test if the task is running? The task should just send an email right now, so I can see if it is working, but I'm not getting anything, I'm curious as to whether I'm doing something wrong.
Thanks!
EDIT:
Ok, so I'm halfway there. I can list tasks like so:
<cfdump output="dump.txt" label="catch" var="#createobject("java","coldfusion.server.ServiceFactory").getCronService().listall()#">
which gives me all currently scheduled tasks.
I'm calling my task like this now:
<cfschedule
proxyport="80"
port="80"
action="update"
operation="HTTPRequest"
task="taskManager_init"
interval="60"
publish="NO"
requestTimeOut="500"
resolveurl="NO"
startDate="12/01/2012"
startTime="11:30:00 AM"
URL="http://www.page.com/t/task_manager.cfm"
>
which, when I call and then dump all tasks creates an entry like so:
xx) [undefined array element]
instead of:
xx) [struct]
disabled: NO
file: [empty string]
http_port: 80
http_proxy_port: 80
interval: xxxx
operation: HTTPRequest
password: xxxxxxxxxx
path: [empty string]
paused: NO
proxy_server: [empty string]
publish: NO
request_time_out: 500
resolveurl: NO
start_date: 12/12/2012
start_time: 1:00:00 AM
task: some task
url: xxxxx
username: xxxxxxx
I can remove my [undefined array element]
calling:
<cfschedule action = "delete" task = "taskManager_init">
So, I'm able to add/remove tasks, but they don't show up correctly in the list and hence don't execute as they should.
Any idea what I'm doing wrong? (besides calling my sys-admin on Monday...)
Thanks!
Upvotes: 3
Views: 2275
Reputation: 11120
You could look in the cfroot\lib\neo-cron.xml config file. That would confirm that the information has saved.
A running task can generate output or put details into a log file or DB. Even when the ColdFusion JVM is running perfectly normal, I have seen the scheduler run for months, and then just stop running.
Also path = "#variables.baseUrl#"
looks strange. I don't think the task scheduler support variables as a part of the configuration options. You may have
Upvotes: 2