Reputation: 8732
Is there a way to detect if a script is runned by a scheduled task.
I have a script which gives throws a ClientAbortException
because I am using cfflush
.
I need to detect if the script is running via a scheduled task so the script can run successfully.
Upvotes: 1
Views: 956
Reputation: 14333
This is a duplicate question as Travis said, but another answer is you could add a url parameter to the scheduled task something like ?auto= which would allow you to check the url scope to determine how it was ran.
Upvotes: 1
Reputation: 8732
It seems that you can check it via CGI.HTTP_USER_AGENT:
<cfif CGI.HTTP_USER_AGENT NEQ "CFSCHEDULE">
<cfflush>
</cfif>
Upvotes: 3