Solved

Launch Scheduled Task Again After It Finishes

Posted on 2011-09-20
9
373 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
Comment Utility
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
Comment Utility
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_
Comment Utility
I don't think you need a parameter.  A task should be able to "run" or "reschedule" itself.  
0
 
LVL 39

Expert Comment

by:gdemaria
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 4

Expert Comment

by:duffme
Comment Utility
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
Comment Utility
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
Comment Utility
>> 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
Comment Utility
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
Comment Utility
@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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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 …
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now