Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

ColdFusion 2016 scheduled tasks not working

New Here ,
Jun 13, 2023 Jun 13, 2023

Hi Everyone, I have created a scheduled job that deletes the data from db, when i access the file through browse it runs fine, but when i gave the url in schdule task in CFadmin it does not run, it shows that schedule task ran successfully but it does not run. 

Code in my cfm file: FormSubmit.cfm

<cffunction name="deleteFileFromDB" returnformat="plain"
access="remote">
<cfargument name="fileId" type="string" required="yes" />
        <!--- <cfoutput>Inside Model 2</cfoutput> --->
   <cfset myDataSource = "sds_dev" />
        <!---  <cfset myDataSource = application.datasource />--->
        <cftry>
<cfquery name="deleteFileDetails" datasource="#myDataSource#">
            DELETE
            from
             uploadFileTest
             where fileId='#arguments.fileId#'
        </cfquery>
<cfcatch>
                <cfoutput>Inside Model catch - #cfcatch.message# - #cfcatch.detail# </cfoutput>
                <cfabort>
            </cfcatch>
        </cftry>
<cfreturn arguments.fileId>
    </cffunction>
 
<cfset partsData = deleteFileFromDB('TestFileForFormIDAsForFinalTestCeasar1')>
Deleted File with id:<cfoutput>deletefileInDB</cfoutput>
 
It run fine when i access the file through browser:
like this, it gives the correct output.
But when i give this url in schedule task it does not run.
Please help.
129
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 13, 2023 Jun 13, 2023
LATEST

Do any of the cf logs show anything at the time the task is run? If not, modify the task to have it save its output to a file. What does it show?

 

Or create a cf page that does a cfhttp call to that url for the task, and cfdump the cfhttp scope. What does it tell you?

 

A first guess is that the url is protected by a web server that implements windows authentication, which is not supported by cf scheduled tasks or cfhttp. This might be easily solved by putting the task in a separate folder with other means of protecting it (such as by ip address).

 

(Other common problems stem from when the url is using https, and there are solutions for that, but you are not using that )

 

Let's us know what you find. 


/Charlie (troubleshooter, carehart. org)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources