开发者

Quartz Cron Expression: Run Job Every 10 minutes starting NOW (immediately)

I am using Quartz Scheduler using Spring. I want to configure the same with following schedule:

Run Job Every 10 minutes starting NOW

I am using following expression for the same.

0 */10 * * * ?

I thought * in the minutes field would make it run the first minute, but it does not do that way. It runs the first 10th minut开发者_StackOverflow中文版es from now and then every 10 minutes afterwards. Can anybody please suggest me the reason for this behavior and the solution to my problem also?


0 0/10 * 1/1 * ? *

Please see : http://www.cronmaker.com/


check the minute your at now and add them as a list to your crontrigger. if you start the trigger at minute 12 for example add

0 2,12,22,32,42,52 * * * ? 

as your cron expression

Edit:

Another solution would be to define a simpletrigger that repeats every ten minutes

SimpleTrigger trigger = new SimpleTrigger("myTrigger",
                                            null,
                                            new Date(),
                                            null,
                                            SimpleTrigger.REPEAT_INDEFINITELY,
                                            10L * 60L * 1000L);


You can use something like

0 1-59/10 * * * ?

That will trigger the job at any minute and 10 minutes after that. I didn't try it but it looks right. :)


*/10 * * * *

Every 10 minutes starting from the moment you create the cron job, wether you prefer (user crontab, /etc/cron.d/, ...).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜