Alfresco has a cron-like system that allows you to run a job at regular intervals. The documentation specifies as an example the expression 0 0/2 * * * ?
which will make the job run every 2 minutes. However, in a lot of code I see people using the expression 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).
So my question is, is there any difference in functionality between the expression 0/2
and */2
? And as a followup, is there a place where Alfresco’s syntax is properly documented?
Advertisement
Answer
Oliver Charlesworth‘s comment led me to the Quartz docs that contain the answer:
You can also specify ‘/’ after the ‘*’ character – in this case ‘*’ is equivalent to having ‘0’ before the ‘/’.
So 0/2
and */2
are equivalent cron expressions.