Solved

Launch Scheduled Task Again After It Finishes

Posted on 2011-09-20
9
379 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

803 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