Solved

Launch Scheduled Task Again After It Finishes

Posted on 2011-09-20
9
386 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Get Actionable Data from Your Monitoring Solution

Your communication platform is only as good as the relevance of the information you send. Ensure your alerts get to the right people every time with actionable responses. Create escalation rules that ensure everyone follows the process and nothing is left to chance.

 
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

Get Actionable Data from Your Monitoring Solution

Your communication platform is only as good as the relevance of the information you send. Ensure your alerts get to the right people every time with actionable responses. Create escalation rules that ensure everyone follows the process and nothing is left to chance.

Question has a verified solution.

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

Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

696 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