Cron expression for a time range

后端 未结 3 1606
忘了有多久
忘了有多久 2020-12-11 08:19

I am using Quartz.Net to schedule my jobs in my application. I was just wondering if a CRON expression for the following scenario can be built:

Every

3条回答
  •  無奈伤痛
    2020-12-11 08:22

    robyaw,

    Thanks a lot for your answer. And I apologize for such a delay in replying. I had actually been off for a while. Your solution indeed works. I had to create 3 CRON triggers for the time range that I had specified. You were right with the time ranges that you had mentioned. However, for the 3 CRON expressions that you had mentioned. I am afraid they might not work as intended. These expressions work for the time range : 2:15AM - 5:20AM - Everyday

    1) * 15-59 2 * * ? - Every second from 2:15AM to 3:00AM, ie, 2:15:00AM to 2:59:59AM

    2) * 0-59 3-4 * * ? - Every second from 3:00AM to 5:00AM, ie, 3:00:00AM to 4:59:59AM

    3) * 0-19 5 * * ? - Every second from 5:00AM to 5:20AM, ie, 5:00:00AM to 5:19:59AM

    @gauteh : Please note that Quartz .Net actually supports secondly trigger.

    Hope this helps others who might need a solution to a similar problem.

提交回复
热议问题