I have the following cron expression in my system:
0 0 0/1 1/1 * ? *
and you know what? I have no idea what it means. The guy who has written it is on his holiday for the next 2 weeks so I have to find out on myself. The documentation can be found here
According to the documentation we have:
* * * * * * *
| | | | | | |
| | | | | | +-- Year (range: 1970-2099)
| | | | | +---- Day of the Week (range: 1-7 or SUN-SAT)
| | | | +------ Month of the Year (range: 0-11 or JAN-DEC)
| | | +-------- Day of the Month (range: 1-31)
| | +---------- Hour (range: 0-23)
| +------------ Minute (range: 0-59)
+-------------- Second (range: 0-59)
Ok, let me tell you what I think: I believe that the expression means:
start when:
seconds: 0
minutes: 0
hours: 0
dayOfMonth 1
monthOfYear any
dayOfWeek any
year any
run every:
1 hour
1 dayOfWeek
when:
dayOfWeek same as on first execution
However available cron expression monitors says that it simply means every hour. As the one who has written that is Senior Java Dev, he must have known any reason for writing such expression instead of:
0 0 * * * * *
We use org.springframework.scheduling.quartz.QuartzJobBean
.
Short summary
Well, I think that my question is: what is the difference between 0 0 0/1 1/1 * ? *
and 0 0 * * * * *
?
Edit:
The documentation can be found here.
?
in one of dayOfWeek and dayOfMonth:Support for specifying both a day-of-week and a day-of-month value is not complete (you must currently use the ‘?’ character in one of these fields).
0 0 * * ? *
is an equivalent expression to the0 0 0/1 1/1 * ? *
IMO at least nowadays