too many scheduled tasks in the CF-backend

32 views
Skip to first unread message

hofar...@houseoffusion.com

unread,
Dec 22, 2013, 5:49:16 PM12/22/13
to ColdFusion Technical Talk

Hi list !
I have a strange
problem. A customer of mine has
programmed a cf-page with cfschedule years ago.
And now I have seen, that there are thousands
of test-entries in the scheduler.
I want to clear now programmatically
the neo-cron.xml, since I don't want
to delete approximately 3000-4000 scheduled
tasks manually in the CF backend. :-(
Any ideas how to do this ?

We run CF 8 on Windows.

Uwe

P.S.: This message is a resend of my message from 12/17/2013 that
obviously never got posted.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357375

hofar...@houseoffusion.com

unread,
Dec 22, 2013, 6:10:02 PM12/22/13
to ColdFusion Technical Talk

Yep. With a combination of cfschedule and a Java serviceFactory. You can
retrieve a list of all scheduled tasks using the Java object then loop over
it to delete based on whatever condition you like. You get back an array
of structs where the name of each task is contained in the key "Task". I'm
basing this mostly on this link:
http://stackoverflow.com/questions/2320396/how-to-get-list-of-scheduled-tasks-and-last-run-results-in-coldfusion

This example would delete everything:

<cfset factory = createObject("java", "coldfusion.server.ServiceFactory")>
<cfset allTasks = factory.CronService.listAll()/>
<cfloop index="i" from="1" to="#ArrayLen(allTasks)#">
<cfschedule action="delete" task="#allTasks[i].task#">
</cfloop>
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357376
Reply all
Reply to author
Forward
0 new messages