Run cron job every 10 minutes, from 8:30 to 9:30 am

i want to run a job every 10 minutes between 8:30 and 9:30 (which means run at 8:30, 8:40, …, 9:20)

can any one help me out?
is cron expressions supports time intervals ?

regards
karishma

Welcome @karishma_karish to nixCraft forum!

There is no simple way or regex for time such as 8:30 to 9:30. It is pretty easy for 8 to 9:

# Run at every 10th minute past every hour from 8 through 9
*/10 8-9 * * * /path/to/job

However, you can build logic as follows:

  1. Start at 8:30
    30 08 * * * /path/to/job
  2. Run at every 10th minute past every hour from 8 through 9:
    */10 8-9 * * * /path/to/job
  3. Last job at 9:30
    30 9 * * * /path/to/job
  4. Alternatively, just write the full entries:
30 8 * * * /path/to/script
40 8 * * * /path/to/script
50 8 * * * /path/to/script
59 8 * * * /path/to/script
00 9 * * * /path/to/script
10 9 * * * /path/to/script
20 9 * * * /path/to/script
30 9 * * * /path/to/script
  1. Another option:
# start at 8:30,8:40,8:50
30,40,50 8 * * * /path/to/job
# start at 9:00,9:10,9:209:30 
00,10,20,30 9 * * * /path/to/job

The fifth is a good choice. Let me know.