简体   繁体   中英

Quartz | Cron expression not working as expected

I'm trying to build up a cron expression that will trigger in every minute starting from a given hourly range.

My expression would be:

0 0/1 12/10-14 * 1-5 ?

I'm expecting this to work as, starting from 12.04 AM to 02.00PM trigger at every minute.

But when I start the application it just trigger from next minute of the hour 12.01 despite the range or starting minute at 12.10.

There is mistake in your cron expression.

0 {start minute}/{every minute} [from hour- to hour] * 1-5 ?

So the answer is

It will start at 12:00 AM - 01 : 00 AM

0 4/1 0-1 * 1-5 ?

It will start at 12:00 AM - 02 : 00 PM

0 4/1 0-14 * 1-5 ?

It will start at 12:00 AM - 02 : 00 PM Every Day

0 4/1 0-14 * * ?

Link provides you with the Quartz corn expressions Quarts scheduled expression documentation The expression should be like

0 4/1 0-1 * 1-5 ?

to start a 12.04 AM and end at 2.00pm you can test your corn expression in this Cornmaker

Try this expression

0 4/1 0-14 * * ?

It will start the job at 4th minute past 12:00 am and then execute every minute after that till 2:00 PM

 0 4/1 0-14 * * ? | | | | | | | | | | | |--------till 2:00 pm | | |---------------------------12:00am | |-------------------------------------------every minute |----------------------------------------------------------------Start at 4th Minute 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM