简体   繁体   English

Spring Cron表达式的含义“* / 5 * * * *?”

[英]Meaning Of Spring Cron Expression “*/5 * * * * ?”

I used spring scheduler with cron expression 我使用了带有cron表达式的spring scheduler

*/5 * * * * ? * / 5 * * * *?

(for every 5 seconds) . (每5秒钟一次)。 It's worked for last one month, suddenly it's stopped in last two days. 它工作了一个月,突然它在最后两天停了下来。

After Restarting server again it's working fine. 重新启动服务器后,它运行正常。

Is there any difference between 两者之间有什么区别吗?

*/5 * * * * ? * / 5 * * * *?
*/5 * * * * * * / 5 * * * * *

? it's based on any month basis. 它基于任何月份。

So what is the meaning of ? 那么这是什么意思 here. 这里。 Want to know the reason why it's stopped? 想知道它停止的原因吗?

Thanks in Advance. 提前致谢。

Here " 这里 ”

* *

means all values . 意味着所有价值观 For example, dayofmonth="*" means run the process every day. 例如,dayofmonth =“*”表示每天运行该过程。

"?" “?”

is used only for dayofmonth and dayofweek attribute 仅用于dayofmonth和dayofweek属性

and means "without regard to this value" For example, hours="12" dayofweek="MON-FRI" dayofmonth="?" 并且意味着“不考虑这个值”例如,hours =“12”dayofweek =“MON-FRI”dayofmonth =“?” means "Run at noon every weekday (without regard to the day of the month)". 表示“每个工作日中午运行(不考虑当月的某天)”。

"," “”

separates multiple values. 分隔多个值。 For example, dayofweek="MON,FRI" means every Monday and Friday. 例如,dayofweek =“MON,FRI”表示每周一和周五。 Do not includes spaces after the comma. 逗号后不要包含空格。

"/" “/”

specifies increments. 指定增量。 For example, minutes="0/15" means start at minute 0 and run every 15 minutes. 例如,分钟=“0/15”表示从第0分钟开始,每15分钟运行一次。

"L" is used only for dayofmonth and dayofweek and means "the last day of the month/week". “L”仅用于dayofmonth和dayofweek,表示“月/周的最后一天”。

From the Quartz documentation : 来自Quartz文档

The '?' '?' character is allowed for the day-of-month and day-of-week fields. 允许使用字符表示日期和星期几字段。 It is used to specify “no specific value”. 它用于指定“无特定值”。 This is useful when you need to specify something in one of the two fields, but not the other. 当您需要在两个字段之一中指定某些内容而不是另一个字段时,这非常有用。 See the examples below (and CronTrigger JavaDoc) for clarification. 请参阅下面的示例(和CronTrigger JavaDoc)以获得说明。

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

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