指定cron作业的任意开始和结束时间
对于Quartz Cron,是否可以指定对应于以下的cronexpression:
For Quartz Cron, is it possible at all to specify a cronexpression that corresponds to:
每6分钟运行一次,从9开始: c>
我试图写cronexpression 0 12-37 / 6 9- 17? * *
,但这只会每小时运行一次。我还了解 cronexpression 0/6 9-17? * *
对应于在上午9点至下午5点之间每6分钟运行
I attempted to write the cronexpression 0 12-37/6 9-17 ? * *
but this does only runs once an hour. I also understand that the cronexpression 0 /6 9-17 ? * *
corresponds to Run every 6 minutes between the hours of 9 AM and 5 PM
.
但是有什么方法来约束cronexpression的开始和结束分钟吗?更一般来说,我可以指定一个任意的开始和结束时间与正在运行每个 n
时间间隔的问题的作业吗?
But is there any way to constrain the starting and ending minutes on that cronexpression? More generally, can I specify an arbitrary start and end time with the job in question running every n
intervals of time?
您可以使用3个cron字符串:
You can do it with 3 cron strings:
0 12-59/6 9 * * *
0 /6 10-16 * * *
0 0-37/6 17 * * *
给他们所有相同的任务运行。
Give them all the same task to run.