theideabulb
asked on
Launch Scheduled Task Again After It Finishes
I am looking for a good solution that will launch a scheduled task immediately after it finishes. The process i run runs at all different lengths so its hard to schedule it for every 20 minutes, etc. For each records that its processing, it sets and indicator to 'Y' when its done, so I can eventually shut it down for the day, but i would like to make it run non stop til its done. Overall the process can last for up to 10 hours to go through all the records it needs to do.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I don't think you need a parameter. A task should be able to "run" or "reschedule" itself.
Oh sorry, details, details... can't you just include the cfschedule command at the end of the process that you've launched?
Alternatively, create a new wrapper around it..
RepeatScheduler.cfm
<cfinclude template="runMytask.cfm">
<cfif NOT timeToStopCondition>
<cfschedule repeatScheduler.cfm ... add a few minutes for start time..>
</cfif>
Alternatively, create a new wrapper around it..
RepeatScheduler.cfm
<cfinclude template="runMytask.cfm">
<cfif NOT timeToStopCondition>
<cfschedule repeatScheduler.cfm ... add a few minutes for start time..>
</cfif>
You can set a trigger, which in one form relies on events recorded in event logs. Is this task recorded in the event logs? You could just have it triggered by its own logged event. Alternatively, maybe have two events that just switch back and forth, whether triggered by or explicitly called by one another, perhaps having them stop the other task if necessary as an "initialization".
ASKER
Actually what I wound up doing is at the end of my process, i go back an check to if more records are needed to be processed, if so, i create a new scheduled task for one cycle, then once it starts again, i delete the task. Then do that over and over again. Eventually there will be no more records to process, so it won't create the scheduled task again at the end and i am done for the day. I created one other task that kicks off the first one, early in the AM. Its been going for a few hours now and so far, so good.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
its been deleting it fine all day, its just about to finally finish for the day.
Yes, i create a task that runs it for the first time, then after that, it should just go on autopilot.
Thanks for the link to Ben's site, that is a nice tip and i will add that to help make sure its cancels any task that tries to run over the other.
Yes, i create a task that runs it for the first time, then after that, it should just go on autopilot.
Thanks for the link to Ben's site, that is a nice tip and i will add that to help make sure its cancels any task that tries to run over the other.
@theIdeaBulb, if you have a snippet of code you can post, I bet that would be liked by future readers trying to do the same thing!
ASKER