Copy link to clipboard
Copied
I'm having trouble getting cfschedule to work.
When I run B.CFM from the browser, it works. When I try and run B.CFM from A.CFM, nothing happens.
What am I doing wrong ?
THIS IS A.CFM
<html>
<head>
<title>
</title>
</head>
<body>
<cfschedule action="update" task="try" operation="httprequest" url="http://URL IN HERE/b.cfm"
startdate="06/29/10" enddate="07/02/10" starttime="9:00 AM" interval="75">
</cfschedule>
</body>
</html>
THIS IS B.CFM
<html>
<head>
<title>
</title>
</head>
<body>
<cfset todir='DRIVE AND DIR IN HERE'>
<cfset tofile='delthis_.txt'>
<cfset todirfile=todir & tofile>
<cffile action="write" file="#todirfile#" output="a">
</body>
</html>
Copy link to clipboard
Copied
The first thing to check when ever one says "I can run the code directly, but ColdFusion can't with a schedule task" is permissions. What are your permissions, what are the ColdFusion service|daemon permissions and what security is on the http resource that is being accessed.
Copy link to clipboard
Copied
Sorry for writing back so late.
A coworker has administrative rights. Tried on his computer and the same thing happens, b.cfm runs ok but not when trying to schedule by a.cfm.
Does this rule out permissions as being the problem ?
Does the code seek ok ?
Copy link to clipboard
Copied
lwfg wrote:
Does this rule out permissions as being the problem ?
No, because a schedule task does not run as a human user. It runs as the user defined in the system to run the ColdFusion service|deamon. On Window systems, which this type of problem typically happen, it is the user that the ColdFusion service "starts under" in the Windows Services Panel. By default this is the "LocalSystem" user which has plenty of permissions for the local system but usually no permissions from the network domain.
What usually happens here, is that the b.cfm file you are trying to execute is protected by a 'Windows Integrated Authentication' setting in the IIS web server. ColdFusion is not a Microsoft applicaiton and it can not authenticate itself to the Windows Integrated system.
Copy link to clipboard
Copied
Try going to CF admin, Logging Settings, and enabling logging of scheduled tasks. Then run your test and look at the scheduler log file to see if it actually tried to run it.
Along the lines of what Ian suggested, a similar problem often comes from application authentication checks done in an application.cfm file, so take a look for those.
Also, if you add /publish="yes" and file="xxx" in the CFSCHEDULE tag, you'll likely get more info on the error. If the URL is bad, you'll get "Connection Failure". Put a couple of lines of output into the A.CFM file, and see if they show up in the output file.
Finally, try replacing the CFSCHEDULE tag in A.CFM with a CFLOCATION, just to make sure that you have the URL in there typed correctly.