石英cron表达式从现在开始每14分钟运行一次 [英] Quartz cron expression to run job at every 14 minutes from now

查看:321
本文介绍了石英cron表达式从现在开始每14分钟运行一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在想每隔14分钟执行一次工作。

I want to run a job at every 14 minutes form now.

例如,如果我在11:04 am安排工作,使用 0 0/14 * * *? cron表达式。然后
的预期触发时间假设为11:18,11:32,11:46,依此类推。
,但是它将在11:00,11:14:11,28:11:42,11:56,12:00触发,这不是预期的。
及其为何在11:56后的12:00点触发,差异仅4分钟。

For example if I schedule a job at 11:04 am, using 0 0/14 * * * ? cron expression. then expected fire time suppose to be 11:18,11:32,11:46 and so on . but it will fire at 11:00,11:14:11,28:11:42,11:56,12:00 which is not expected. and why it fired at 12:00 o'clock after 11:56, there is diff of only 4 min.


  • 我如何使用cron表达式实现我想要的?

  • 有人可以向我解释石英cron的这种行为吗?

预先感谢。

推荐答案

好吧,0/14可以让您在00、14、28点火,42、56,然后每小时的00分钟再次显示。因此最后间隔不是14分钟而是4分钟。那就是cron的工作方式。仅当60除以间隔的余数为零时,您才能获得以分钟为单位的等间隔。

Well, 0/14 give you fire time at 00, 14, 28, 42, 56 and again at 00 minutes of every hour. So last interval will be not 14 but 4 minutes. Thats how cron works. You can get equals interval in minutes only for cases when remainder of the division 60 by your interval is zero.

这篇关于石英cron表达式从现在开始每14分钟运行一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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