Himanshu Yadav Himanshu Yadav - 3 months ago 24
Java Question

Spring Cron expression: 10 minutes after every hour

I am trying to configure a cron expression which runs 10 or 15 minutes after for every hour. Application has couple of cron jobs and I am trying to schedule them 15 mins apart for every hour.
After reading couple of examples I came up with these expressions:

10 0 * * * ?
and
25 0 * * * ?


Can you please verify them if these are correct expressions or not?

Answer

The way you've got it, the jobs only run @ 12:10am and 12:25am, respectively. Change the zeros to stars and you'll accomplish your goal of running the 2 jobs 10 and 25 minutes past every hour.

Instead of:

10 0 * * * ?
25 0 * * * ?

Use:

10 * * * * ?
25 * * * * ?