Copy link to clipboard
Copied
I have create scheduled task in Coldfusion to run daily. Basically this task executes 1 URL every day which sends reminder emails for one of or web-app
Now problem with this task
1. It does not run automatically
2. When I click on 'Run' in CF-Admin for this task - it says - This scheduled task was completed successfully. But actually task does nor run (I can confirm as no reminder emails are received for one of our web-app)
3. When that URL which is scheduled in scheduled task - is run manually in browsver - it works and reminder emails are received
4. One more thing I observed is - I scheduled task to run say at 06:30 AM but when I open the task - the time - it shows is something like this - {ts '1899-12-30 06:30:00'}
Copy link to clipboard
Copied
Addressing points 1-3, you should enable scheduled task logging (in the CF Admin "logging settings" page), and then look to that scheduler.log to see what it shows. It may be that the task IS running, and "misfiring" perhaps because the URL is FAILING when CF calls it. (Also, you can enable the feature in the scheduled task itself to save its output to a file. Does it show an error? If so, read on.)
You say, "but the URL works in a browser". That's a classic dilemma. First, are you running it in a browser ON THE SAME SERVER AS CF? Sometimes, a page you call may be limited to be only able to run from some servers and not others.
But second here's a more likely explanation: is that an https request? If so, are you running an older version of CF, or an older version of Java (underlying CF, that it points to)? If so, the problem is that while even a browser on the CF server can run it (because the browser is rather modern), the JVM underlying CF may be older (perhaps years old). This problem would affect not only a scheduled task but a CFHTTP (had you tried that)?
The solution for most in this case is to update the Java that CF uses. I cover all this in a post on this very topic:
https://coldfusion.adobe.com/2019/06/error-calling-cf-via-https-solved-updating-jvm/
Let us know if this info gets you going.