Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Launch Scheduled Task Again After It Finishes

Posted on 2011-09-20
9
Medium Priority
?
395 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 1000 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
[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

 
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 1000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

609 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