如何在 ColdFusion 中获取计划任务列表和上次运行结果? [英] How to get list of scheduled tasks and last run results in ColdFusion?

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

问题描述

我们正在尝试为我们的 cron 作业构建仪表板 ---- CF、Java、SQLServer 等,以便我们可以查看上次运行的时间、结果以及计划执行的时间接下来运行.

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.

有没有办法通过 CFAdmin API 或一些未记录的 <cfschedule> 技巧来获取以下列表:

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

  1. 安排了哪些任务?
  2. 上次运行时间是多少?
  3. 成功了吗?
  4. 计划何时再次运行?

我们目前使用的是 CF8,但将在几周内升级到 CF9.

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

推荐答案

我为你做了一些研究.我发现了一个更旧的参考,它仍然有效,至少在 CF8 中,大概在 CF9 中也是如此.

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>

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

这回答了您的问题 #1 和 #4.至于#3,没有答案.ColdFusion 的计划任务引擎只是在规定的时间加载指定的 URL.没有成功或失败之分——它只是执行一个 HTTP 请求.

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.

希望这会有所帮助.

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆