Cron表达每两年安排一次工作 [英] Cron expression to schedule a job every two years

查看:713
本文介绍了Cron表达每两年安排一次工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个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:


  1. Seconds

  2. Minutes

  3. 小时

  4. 月日


  5. 日周

  6. 年份(可选)

  1. Seconds
  2. Minutes
  3. Hours
  4. Day-of-Month
  5. Month
  6. Day-of-Week
  7. 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屋!

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