Spring cron expression every after 30 minutes

微笑、不失礼 提交于 2019-12-12 12:13:07

问题


Java spring - I have following cron expression for cron job.

0 0/35 * * * ?

But above mentioned cron expression fires once in an hour and like as follows

1:35 2:35 3:35 4:35

I want to fire every after 35 mins instead once in an hour

any quick suggestion ?


回答1:


Cron syntax is

sec min hour day day_of_month month day_of_week year

So what you would want is

0 0,35 * * * * ?

So it will fire on minutes 0 and 35 of each hour.

See the Quartz docs for this, as Spring is using Quartz as scheduler here. Those docs also explain the special chars like * ? - , and others.




回答2:


You have specified an increment instead of two values.

There is no minute 35 + 35 = 70. Replace 0/35 with 0,35.



来源:https://stackoverflow.com/questions/8560613/spring-cron-expression-every-after-30-minutes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!