简体   繁体   English

这个 CRON 表达式的间隔是多少?

[英]What is the interval of this CRON expression?

I am unable to decode the interval defined in the CRON expression below, Please explain it with some details.我无法解码下面 CRON 表达式中定义的间隔,请详细解释一下。

@Scheduled(cron = "0 0/1 * 1/1 * ?")

I understand the basic structure of a CRON sequence but I can't find what does 0/1 or 1/1 means?我了解 CRON 序列的基本结构,但我找不到0/11/1是什么意思?

In a cron expression, the various fields have a strict range which values are allowed:在 cron 表达式中,各个字段都有一个严格的允许值范围:

field          allowed values
-----          --------------
minute         0-59
hour           0-23
day of month   1-31
month          1-12 (or names, see below)
day of week    0-7 (0 or 7 is Sunday, or use names)

A field may contain an <asterisk> ( * ), which always stands for <first>-<last> .一个字段可能包含一个 <asterisk> ( * ),它总是代表<first>-<last> Another possibility is ranges of numbers .另一种可能性是数字范围 Ranges are two numbers separated with a <hyphen> ( - ).范围是用 <连字符> ( - ) 分隔的两个数字。 The specified range is inclusive.指定的范围包括在内。 For example, 8-11 matches all number 8,9,10,11例如, 8-11匹配所有数字8,9,10,11

In combination with ranges, you can have a step value , noted as /<number> which tells you how many numbers should be skipped in the range.结合范围,您可以有一个步长值,记为/<number> ,它告诉您应该在范围内跳过多少个数字。 Example: 2-7/2 allows the numbers 2,4,6 .示例: 2-7/2允许数字2,4,6

In some cron-systems, the notation <start>/<number> is a shorthand for <start>-<last>/<number> .在某些 cron 系统中,符号<start>/<number><start>-<last>/<number>的简写。 Such an example is the Quartz Job Scheduling Library:这样的例子是 Quartz 作业调度库:

The / character can be used to specify increments to values. /字符可用于指定值的增量。 For example, if you put 0/15 in the Minutes field, it means every 15th minute of the hour, starting at minute zero .例如,如果您在 Minutes 字段中输入0/15 ,则表示每小时的第 15 分钟,从第 0 分钟开始 If you used 3/20 in the Minutes field, it would mean every 20th minute of the hour, starting at minute three – or in other words it is the same as specifying 3,23,43 in the Minutes field.如果您在 Minutes 字段中使用3/20 ,则表示每小时的第 20 分钟,从第三分钟开始- 或者换句话说,它与在 Minutes 字段中指定3,23,43相同。 Note the subtlety that /35 does *not mean every 35 minutes - it means every 35th minute of the hour, starting at minute zero – or in other words the same as specifying 0,35 .请注意/35的微妙之处 * 并不意味着every 35 minutes - 它意味着每小时的第 35 分钟,从零分钟开始- 或者换句话说,与指定0,35相同。

source: Quartz Job Scheduling Library Manual来源: Quartz 作业调度库手册

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

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