如何以<60秒的间隔运行ColdFusion计划任务? [英] How can I run a ColdFusion scheduled task at an interval &lt;60 seconds?

查看:180
本文介绍了如何以<60秒的间隔运行ColdFusion计划任务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个CFC方法,我想运行在30秒的间隔。但是,问题是ColdFusion不会让我计划以60秒或更低的时间间隔运行的任务。

I have a CFC method that I would like to run at an interval of 30 seconds. However, the problem is ColdFusion won't let me schedule a task that runs at an interval of 60 seconds or lower. Does anyone have a suggestion about how I can (and should) accomplish this?

要预先回答脚本运行时间超过30秒时会发生什么的问题,或者

To preemptively answer the question "What happens when your script runs longer than 30 seconds," or any other question like that, I have already taken all that under consideration and it is not a concern.

我正在运行ColdFusion 8.0.1(w / hotfix 4)。我已经采取了所有的考虑,这不是一个问题。在Windows Server 2003(IIS6)。注意,我使用Java 1.6u21作为ColdFusion的JVM。

I'm running ColdFusion 8.0.1 (w/ hotfix 4) on Windows Server 2003 (IIS6). As a side note, I'm using Java 1.6u21 as my JVM for ColdFusion.

提前感谢。

推荐答案

这样做的唯一方法是手动编辑计划任务的文件。

The only way to do this is with some manual editing of the file for your scheduled tasks.

因此:


  1. 创建计划任务,间隔时间为5分钟。

  2. lib 中打开 neo-cron.xml CF安装的目录。您可能需要先 备份。

  3. 搜索计划任务的名称。这是一个大块的XML,所以你可能想格式化它,并在XML编辑器中搜索它。

  4. 稍后任务的名称,你应该看到这样:< var name =interval>< string> 300< / string>< / var> 。这是任务运行之间的秒数。这里是秒,所以你可以手动调整到30,然后保存文件并关闭它。

  1. Create the scheduled task with an interval of say 5 mins.
  2. Open the file called neo-cron.xml in the lib directory of your CF install. You might want to back it up first.
  3. Search for the name of your scheduled task. It's a big chunk of XML so you might like to format it and search for it in a XML editor.
  4. A little after the name of the task you should see something like this: <var name="interval"><string>300</string></var>. This is the number of seconds between when the task runs. It's in seconds here, so you can manually adjust it to 30 and then save the file and close it.

这将在CF管理员中显示为1分钟,但它应该每30秒运行一次 - 添加日志记录, !

This will still show as 1 min in the CF admin but it should run every 30 seconds - add logging to prove it if you wish!

不是,如果您使用CF管理员编辑任何其他计划任务,您的手动更改不会受到影响,但如果您编辑实际任务手动调整它将覆盖您的更改。

Not that if you edit any other scheduled task using CF admin your manual changes will be unaffected, but if you edit the actual task you manually adjusted it will overwrite your changes.

希望有所帮助!

这篇关于如何以<60秒的间隔运行ColdFusion计划任务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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