Link to home
Start Free TrialLog in
Avatar of Coast Line
Coast LineFlag for Canada

asked on

retrieving the Scheduled Task already which exists in the CFADMIN

I create a Cfschedule Task Progmatically, Now the Cfschedule task has been created, on the next vists, i had to run that schedular again. So just wanna check if that specific Schedular with Name exists, just use the cfschedular RUN command otherwise if it is coming first time, Create the Update for the Cfschedular which will create the schedular

1. I know it can be done through underlying serviceFactory Method, But i cannot use this because this can be blocked anytime.

2. I had seen a UDF at the CFLIB which checks for the Existing Task, but that is also checking for the XML/neo something file.

3. I like the Solution of 2nd one but can be modified like it should parse the path automatically and fetch the contents of the XML file and then parse it and find the specifc Task Name!

Well i really have no idea how to do what i asked, but u experts can guide me!

Really a Worth 500 points Answer!
Avatar of SidFishes
SidFishes
Flag of Canada image

scheduled tasks are stored in neo-cron.xml which is in the \lib directory of the coldfusion program directory AFAIK, You can't really parse the path automatically as cf path parsing only works for serveable files. It is possible to get the task name though.
I like the Solution of 2nd one but can be modified like it should parse the path automatically and fetch the contents of the XML file and then parse it and find the specifc Task Name!

The IsScheduledTask function already does all that. So I'm not sure what you're asking ?

Though if you're on a shared host, they may not allow you access to the XML files either
if that specific Schedular with Name exists, just use the cfschedular RUN command otherwise if it is coming first time, Create the Update for the Cfschedular


You don't need a special function for that. Just RUN the task. CF will tell you if it doesn't exist! A cftry / cfcatch should be all you need.

<cftry>
       <cfschedule action="run" task="A task that doesn't exist">  
    <cfcatch>
         task doesn't exist. update/create it with <cfschedule ...>
    </cfcatch>
</cftry>
Avatar of Coast Line

ASKER

@agx, i think your point is valid as we can wrap around try catch and if will through an error and catch will create the schedular

Hmm! seems valid to me but needs more clarification
Hmm! seems valid to me but needs more clarification
No, it really is that simple. What is your question?
my question was that my servers do bounce every few days and schedulled tasks gets cleared off! also wanna make such a secure way that it should ho for some internal undocumeneted or restricted way to check the file and run the scheduleer
do bounce every few days and schedulled tasks gets cleared off!

What does "cleared off" mean? Scheduled tasks exists until _you_ delete them.  

make such a secure way that it should ho for some internal undocumeneted or restricted way to check the file and run the scheduleer

It's not clear what you're asking.  Could you rephrase that?
i mean to say currently i am using the ServiceFactory Java Method which may be blocked!

second i do not want to use the method which calls its neoxml file
ASKER CERTIFIED SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial