简体   繁体   English

Alfresco Cron语法:0/2和* / 2之间的区别?

[英]Alfresco cron syntax: difference between 0/2 and */2?

Alfresco has a cron-like system that allows you to run a job at regular intervals. Alfresco具有类似cron的系统,可让您定期运行作业。 The documentation specifies as an example the expression 0 0/2 * * * ? 例如, 文档指定表达式0 0/2 * * * ? which will make the job run every 2 minutes. 这会使作业每2分钟运行一次。 However, in a lot of code I see people using the expression 0 */2 * * * ? 但是,在很多代码中,我看到人们使用表达式0 */2 * * * ? instead, the difference being that the zero is replaced by an asterisk. 相反,区别在于零被星号代替。 This syntax is more similar to the syntax found in some Unix implementations of cron , but I don't think I can blindly assume they work the same (Alfresco's syntax has a seconds field that Unix syntax lacks, for instance). 这种语法与某些cron的Unix实现中语法更相似,但我认为我不能盲目地假设它们的工作原理相同(例如,Alfresco的语法具有Unix语法缺少的字段)。

So my question is, is there any difference in functionality between the expression 0/2 and */2 ? 所以我的问题是,表达式0/2*/2之间的功能是否有区别? And as a followup, is there a place where Alfresco's syntax is properly documented? 作为后续,是否有适当的地方记录Alfresco的语法?

Oliver Charlesworth 's comment led me to the Quartz docs that contain the answer: Oliver Charlesworth的评论使我进入了包含答案的Quartz文档

You can also specify '/' after the '*' character - in this case '*' is equivalent to having '0' before the '/'. 您也可以在'*'字符后指定'/'-在这种情况下,'*'等同于在'/'之前有'0'。

So 0/2 and */2 are equivalent cron expressions. 因此0/2*/2是等效的cron表达式。

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

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