Mia
Mia

Reputation: 6531

Every 7.5 minutes with cron

How to handle fractions with cron? I want to schedule a task to run every 7.5 minutes, was not able to succeed with that.

Basically, 8 times in an hour.

Thanks

Upvotes: 0

Views: 2694

Answers (1)

viraptor
viraptor

Reputation: 34205

You can't do it in cron directly. Cron doesn't support fractions in the time. You've got 2 options really:

  1. Write your own wrapper which will run the task when needed.
  2. Use an ugly hack in cron to schedule two tasks at the same time:

in your crontab:

*/25 * * * * the_task
*/25 * * * * sleep 750 ; the_task

This will spawn both tasks at the same time, but run the second one after sleeping 12.5 minutes. Just make sure your cron does start both tasks at the same time - I don't think the behaviour on 'every x minutes' is standardised.

Upvotes: 2

Related Questions