Search code examples
quartz-schedulerquartz

How to schedule quartz job to run every 3 business days?


Is it possible to schedule quartz job for every 3 business days ?

I'm seeing some examples time or specific day or month examples but how to write quartz expression every 3 business days with any month and any year ?

I have tried 0 0 */3 * 1-5 * but got error day-of-week and a day-of-month is not implemented.

Thanks


Solution

  • You cannot specify both a day-of-week (1-5) and a day-of-month (*/3) - one of them must be ?.

    How about 0 0 0 ? * MON-FRI/3? Or 0 0 0 ? * MON,THU,TUE,FRI,WED?

    EDIT: I tested above - it does not work (the / only seems to work for non-intervals, and the MON,THU,TUE,FRI,WED gets normalized to MON-FRI).

    Looking at the source of the next-trigger-day-computation, I am quite confident now that "every 3 business days" is not possible with a single Quartz Scheduler Cron-Expression.

    What possibly could work would be a collection of expressions. The "Related" links on the right might give some inspiration.