user1968030
user1968030

Reputation:

Create cron Expression from 8:30 to 12:30

I want to create cron that run from 8:30 to 12:30 every one minute in MON,TUE,WED,SAT,SUN.

I create this expression:

0 30/1 8-12 ? * MON,TUE,WED,THU,SUN *

But not work for me.

Upvotes: 0

Views: 961

Answers (1)

Igor
Igor

Reputation: 199

You should use multiple cron expressions instead of just one. Try this:

0 30-59 8 ? * MON-WED,SAT,SUN * // 8:30 - 8:59
0 * 9-11 ? * MON-WED,SAT,SUN * // 9:00 - 11:59
0 0-30 12 ? * MON-WED,SAT,SUN * // 12:00 - 12:30

Please note that Year field isn't mandatory, so you can omit the last field, like this:

0 30-59 8 ? * MON-WED,SAT,SUN // 8:30 - 8:59
0 * 9-11 ? * MON-WED,SAT,SUN // 9:00 - 11:59
0 0-30 12 ? * MON-WED,SAT,SUN // 12:00 - 12:30

Good luck!

Upvotes: 3

Related Questions