Cron Expression: Trigger 02:30 Every Day Except 3-4, 13-14 which Triggers at 11:00

I need one Cron Expressions to trigger the job, which start at 2:30 AM every day, if the day are 3,4,13,14, then the job start at 11:00 AM, thanks.

Hi!

0 0 0/11 3,4,13,14 * ? *

 every 3,4,13,14 at 11:00

0 30 2 1,2,5,6,7,8,9,10,11,12,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 * ? *

 every day at 02:30

Regards,
NaNi

I would suggest using two triggers:

  1. The first one to execute every day except 3, 4, 13, 14:

0 30 2 1,2,5,6,7,8,9,10,11,12,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 * ? *

  1. And the second one to execute on 3, 4, 13, 14:

0 0 11 3,4,13,14 * ? *

I think on day 3, 4, 13, 14 the job mustn’t start twice. :wink:

2 Likes

I believe you should be able to shorten that down to be more readable inline.
0 30 2 1-2,5-12,15-31 * ? *

Alternatively you can also bake the logic into the init of the process. Or have the process manage it’s own trigger and dynamically change it based on the next run.

1 Like

Yeah, you are right, 3,4,13,14 need trigger other job first.

Yeah, your Cron Expressions more concise.

@codemonkee
Thanks for you help , I use you cron as first trigger
@Mike_Goldes
Thanks you very much , I use your cron as second tiggger.

Thanks to all enthusiastic friends.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.