简体   繁体   中英

Cron Expression to execute cron triggers for given times with hour and minute

Here is a similar question

. I want to run Quarta schduler at 1.00pm, 2.10pm, 5.15pm. That means Hour+minute. Any one help me with Cron expression for this plz ?

I'm afraid you can't do as exactly as you specified. As you mentioned in the question, here are some resources, which help you overcome this (Not as exactly as your requirement). But if you can change your minute time to a same number you can achieve this easily. If the minute number is so important you have to run 3 triggers. That seems to be the easiest way. It has mentioned in quartz .

Note that some scheduling requirements are too complicated to express with a single trigger - such as "every 5 minutes between 9:00 am and 10:00 am, and every 20 minutes between 1:00 pm and 10:00 pm". The solution in this scenario is to simply create two triggers, and register both of them to run the same job.

Use three lines like this:

0 13 * * * /bin/Quarta
10 14 * * * /bin/Quarta
15 17 * * * /bin/Quarta

Or whatever command you need to get it running. Might be worth making the command a shell script so you only have to modify the parameters in one place.

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