1

I have to schedule a task on every 4 months, starting from november 1st, using quartz scheduler. I was using cronExpression for the same. But cronExpression will reset every year. So my task will execute in November, January, may etc. But I want it to be executed on November, march, july etc. Also, the same kind of problem exists while scheduling every 2 and more days in a month,it will reset in the next month. That is the next month the job will run on the 1st day. How to solve this issue? Example code is given below.

Cron format 0 0 12 1 */4 ? * Start time Thursday, November 15, 2012 11:44 AM

  1. Tuesday, January 1, 2013 12:00 PM
  2. Wednesday, May 1, 2013 12:00 PM
  3. Sunday, September 1, 2013 12:00 PM
  4. Wednesday, January 1, 2014 12:00 PM
  5. Thursday, May 1, 2014 12:00 PM
4

1 回答 1

2

只需将您的 cron 表达式更改为:

0 0 12 1 3,7,11 ? *

应该是这样的。:-)

于 2012-11-15T12:01:24.823 回答