Cron表达每两年安排一次工作 [英] Cron expression to schedule a job every two years
问题描述
我正在构建一个Quartz cron表达式,以安排一项工作,从今天起每隔两年执行一次。我已经测试了很多,但我认为以下工作之一可以完成这项工作:
I'm building a Quartz cron expression to schedule a job to run on a specific day every two years from today. I've tested quite a few but I think one of the following should do the work:
53 18 23 12 ? 2013/2 => starting on year 2013 and on every two years later on
53 18 23 12 ? */2
但是它们两个都未通过Quartz cron表达式验证测试。正确的cron表达式是什么?
But both of them fail the Quartz cron expression validation test. What could be the right cron expression?
推荐答案
您的Cron表达式不完整。 Quartz Cron表达式由七个部分组成:
Your Cron expression is incomplete. Quartz Cron expressions are made up of seven parts:
- Seconds
- Minutes
- 小时
- 月日
- 月
- 日周
- 年份(可选)
- Seconds
- Minutes
- Hours
- Day-of-Month
- Month
- Day-of-Week
- Year (optional)
因此,如果您要设置运行时间表从2013年开始,每两年的12月24日晚上11:59,表达式将为:
So if you wanted to set up a schedule to run at 11:59pm on Dec 24th every two years starting in 2013, the expression would be:
0 59 23 24 12 ? 2013/2
这篇关于Cron表达每两年安排一次工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!