简体   繁体   English

cron表达式在指定时间运行作业?

[英]cron expression to run the job at specified time?

I am using Spring Quartz and i have a job which runs every 10 mins . 我正在使用Spring Quartz,我的工作every 10 mins It is working fine without any issues using cron expression. 它使用cron表达式没有任何问题,工作正常。

But now i have below requirement. 但现在我有以下要求。

It has to run every 10 mins, but it should not run in the time mentioned below. 它必须每10分钟运行一次,但不应该在下面提到的时间内运行。

Sat 5pm to Sun 9am
Sun 5pm to Mon 9am

How can i write the cron expression to satisfy above condition using single cron expression? 如何使用单个cron表达式编写cron表达式以满足上述条件? Job has to run every 10 mins but it should not run in the time mentioned above. 工作必须每10分钟运行一次,但不应该在上述时间内运行。

Thanks! 谢谢!

You probably need 4 quartz cron expressions: 你可能需要4个石英cron表达式:

0 0/10 * ? * TUE-FRI
0 0/10 0-16 ? * SAT
0 0/10 9-16 ? * SUN
0 0/10 9-23 ? * MON

You can use online cron expression checker to verify quartz-cron expressions. 您可以使用在线cron表达式检查器来验证quartz-cron表达式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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