如何获取ColdFusion中的计划任务和上次运行结果的列表

如何获取ColdFusion中的计划任务和上次运行结果的列表

本文介绍了如何获取ColdFusion中的计划任务和上次运行结果的列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正试图为cron作业---- CF,Java,SQLServer等构建一个仪表板,以便我们可以看到事情最后运行的时间,结果是什么,以及何时计划



有一种方法可以使用CFAdmin API或一些未记录的< cfschedule>


  1. 安排了什么任务?

  2. 上次运行时间是多少?


  3. $ b

    我们目前正在使用CF8,但会在几周内升级到CF9。

    解决方案

    有点研究这个给你。我发现一个有点老的引用,仍然有效,至少在CF8,也许在CF9以及。

     < cfobject type =JAVAaction =Createname =factoryclass =coldfusion.server.ServiceFactory> 
    < cfset allTask​​s = factory.CronService.listAll()/>
    < cfloop index =ifrom =1to =#ArrayLen(allTask​​s)#>
    < cfdump var =#allTask​​s [i]#/>
    < / cfloop>



    这回答了你的问题#1和#4。
    至于#3,可能没有答案。 ColdFusion的计划任务引擎只是在规定的时间加载指定的URL。没有成功或失败 - 它只是执行HTTP请求。



    希望这有助于。


    We're trying to build a dashboard for our cron jobs ---- CF, Java, SQLServer, etc. so that we can see when things were run last, what the result was, and when they're scheduled to run next.

    Is there a way with the CFAdmin API or some undocumented <cfschedule> trick to get a list of:

    1. What tasks are scheduled?
    2. What the last run time was?
    3. Did it succeed?
    4. When is it scheduled to run again?

    We're currently on CF8, but will be upgrading to CF9 within a few weeks.

    解决方案

    I did a little research into this for you. I found a somewhat older reference that is still valid, at least in CF8 and presumably in CF9 as well.

    <cfobject type="JAVA" action="Create" name="factory" class="coldfusion.server.ServiceFactory">
    <cfset allTasks = factory.CronService.listAll()/>
    <cfloop index="i" from="1" to="#ArrayLen(allTasks)#">
        <cfdump var="#allTasks[i]#" />
    </cfloop>
    

    From http://www.bpurcell.org/blog/index.cfm?mode=entry&ENTRY=935

    This answers your questions #1 and #4.As for #3, there can be no answer to that. ColdFusion's scheduled task engine is just loading up the specified URL at the prescribed time. There is no success or fail -- it simply performs an HTTP request.

    Hope this helps.

    这篇关于如何获取ColdFusion中的计划任务和上次运行结果的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 14:20