Solved

Launch Scheduled Task Again After It Finishes

Posted on 2011-09-20
9
381 Views
Last Modified: 2012-05-12
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.

0
Comment
Question by:theideabulb
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 39

Accepted Solution

by:
gdemaria earned 250 total points
ID: 36568040
You can schedule a task using cfschedule.  Some years a go, there was a bug that the task would not clear from the /cfide/administrator list, so the list of tasks got very long.  This is inconvenient, but didn't cause any harm - the tasks weren't running more than they should, just left a record in there.   Hopefully that bug has been fixed by now, just a heads up.
0
 

Author Comment

by:theideabulb
ID: 36568080
Sure, i schedule tasks all the time and have used cfschedule, but I am looking for an idea on how to consistently kickoff the task right after it is finished. I don't see any parameters to repeat immediately after its done executing.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 36568141
I don't think you need a parameter.  A task should be able to "run" or "reschedule" itself.  
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 39

Expert Comment

by:gdemaria
ID: 36568144
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>



0
 
LVL 4

Expert Comment

by:duffme
ID: 36570115
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".
0
 

Author Comment

by:theideabulb
ID: 36570188
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.
0
 
LVL 52

Assisted Solution

by:_agx_
_agx_ earned 250 total points
ID: 36570354
>> then once it starts again, i delete the task.

so .. how many tasks are involved? reason for asking is there used to be a bug that tasks could not delete themselves. not sure if that's what you're doing.

>>  I created one other task that kicks off the first one, early in the AM.

if the tasks shouldn't ever overlap, you can wrap the whole thing in an exclusive cflock. its useful for intensive tasks
www.bennadel.com/blog/?1844-Making-Sure-Scheduled-Tasks-Don-t-Overlap-In-ColdFusion.htm

0
 

Author Comment

by:theideabulb
ID: 36570375
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.
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 36571039
@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!
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question