简体   繁体   English

如何使 G1ANT 中的触发器每 3 分钟运行一次,但如果它处于进程中间,则让它完成它?

[英]How to make the trigger in G1ANT run every 3 minutes but if its in the middle of a process then let it complete it?

I was told to use crontab expression to make my schedule trigger run every 3 minutes, however, I notice that it's not actually running every 5 minutes, what its doing is it runs a process for a period of 3 minutes and then it stops even if the process is not complete.有人告诉我使用 crontab 表达式使我的计划触发器每 3 分钟运行一次,但是,我注意到它实际上并不是每 5 分钟运行一次,它所做的是它运行一个进程 3 分钟然后它停止即使该过程不完整。

I need the trigger to run every 3 minutes but if its in the middle of a process then to complete the current process.我需要触发器每 3 分钟运行一次,但如果它处于进程中间,则完成当前进程。 Can you advise, please?你能建议吗?

I noticed in the schedule trigger you have “start instance” and “stop instance”, currently they are both false.我注意到在计划触发器中你有“启动实例”和“停止实例”,目前它们都是错误的。 My guess is I need to do something with these?我的猜测是我需要对这些做些什么?

The triggers never interrupt the script execution.触发器永远不会中断脚本执行。

The special variable timeout is what will solve your problem.特殊变量timeout将解决您的问题。 According to the manual the timeout special variable:根据手册超时特殊变量:

Defines the maximal robot process duration time (in milliseconds), after which the process terminates;定义机器人进程的最大持续时间(以毫秒为单位),在此之后进程终止; the default value is 180000 (3 minutes).默认值为 180000(3 分钟)。

Which means that a script will stop after 3 minutes if its timeout 's variable value stays default.这意味着如果脚本timeout的变量值保持默认值,脚本将在 3 分钟后停止。

Add the below line of code at the beginning of your script to prevent this from happening after 3 minutes and increase its maximal robot process duration time.在脚本开头添加以下代码行,以防止在 3 分钟后发生这种情况并增加其最大机器人进程持续时间。

♥timeout = 1800000

By the way if you have set up your triggers to launch a script every 3 minutes and the script's duration time is for example 4 minutes, the script will be launched the next time automatically after because it is 1 minute late and it creates a queue of scripts to be executed.顺便说一句,如果您已将触发器设置为每 3 分钟启动一次脚本,并且脚本的持续时间为 4 分钟,则该脚本将在下一次自动启动,因为它晚了 1 分钟,它会创建一个队列要执行的脚本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM