Reading Schedule task details from neo-cron.xml

I found  this code helpful while working with schedule tasks(i’ve been working with it for a while now ;-)).

Schedule tasks that are created in the Coldfusion Administrator can be accessed as structure programatically. This is particularly in need when we need to check through code whether a schedule task has been executed or not. We can also get the details of the existing schedule tasks that are in the Coldfusion administrator.

<!--- Get the scheduler xml file.  It's stored as WDDX in CFroot dir--->
<cffile action="Read"
          file="#Server.ColdFusion.RootDir#/lib/neo-cron.xml"
          variable="TaskXML">

<!--- Convert the WDDX to CFML - and array of structs --->  
<cfwddx action="WDDX2CFML" input="#TaskXML#" output="GetTasks">

<!--- Dump all the schedule tasks in CF Admin in Struct format. ---> 
<cfdump var="#GetTasks#">

The Scheduler configuration file neo-cron.xml stores all the schedule task details in the CF Admin in xml format. We are simply reading the file and converting the WDDX into an array of structs.

The output should look something like this:

scheduletaskdump

Advertisements

2 Comments (+add yours?)

  1. BYJ
    Jan 26, 2011 @ 19:04:59

    Ajithmanmu,
    This is nice but it doesn’t tell us more than what CF admin does. When I doubt whether or not my schedule task is still running, I can’t tell by looking at the log in administrator. By doing this seems to be the same, or am I misunderstood you?
    Is the information in here showing current task that is still running or had been run???

    Reply

    • ajithmanmu
      Jan 28, 2011 @ 17:05:39

      @BYJ..this is just reading the neo-cron.xml file and dumping it…Yes u r rite..it is same as what in the Cf admin..but unfortunately we can’t know whether it has been run or not..Needs more research on this..:-)

      Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: