Reputation: 365
it's strange, i setup corn as
@Scheduled(cron= "0 0/10 * * * ? ")
It did trigger every 10 minutes, but the issue is task runs each second.
Upvotes: 18
Views: 70815
Reputation: 927
If you want to execute every 10 seconds, you should have this:
@Scheduled(cron= "0/10 * * ? * *")
before the / numbers 0 to 9 are possible, the mentioned schedule kicks of at the start of every 10 second interval within the minute. 5/10 kicks after 5 seconds within the 10 second interval.
Upvotes: 6
Reputation: 199
This is what javadoc says :
the first field of the cron is for seconds.
Upvotes: 19