0

I am trying to set up a cron job which runs every 10 minutes but should stop for exact 30 minutes (miss three runs) between 12:15 to 12:45 (should not run for 12:20, 12:30, 12:40), as some other job will run during this period which might conflict with this one.

Is it possible to achieve this in one cron job expression?

Kamal
  • 5,462
  • 8
  • 45
  • 58

2 Answers2

1

I assume that your cronjob expression is like

*/10 * * * * job

In that case: No, it is not possible to do so in one cron job expression.

What you can do is to put a condition in your script that checks the time first thing and exits if it is within {12.15 - 12.45} interval.

Otherwise, you'd better change it to:

0,10,50 0 * * * job
*/10 1-23 * * * job

Linus Swälas
  • 130
  • 1
  • 6
fedorqui
  • 275,237
  • 103
  • 548
  • 598
0

I misunderstood the question at first, no, that can't be done with one job expression.

See also man 5 crontab on your system.

Linus Swälas
  • 130
  • 1
  • 6
  • If we assume the cronjob runs every 10 minutes it means it runs from 00.00 to 23.50. Or at least that's what I understand from the question. – fedorqui Jun 12 '13 at 11:18
  • right @fedorqui, but I am trying to make it run from 0.0 to 0.15 then from 0.45 to 23.50 – Kamal Jun 13 '13 at 07:13