2

I want to run a command 7 to 24 o'clock every two minutes and 24 to the next day 7 o'clock every 10 minutes.

I write

*/2 7-24 * * * command

*/10 24-7 * * * command

But crontab tells me it has problem.So how to fix it? Thank you!

1 Answer 1

4

Midnight is 0, not 24. Furthermore, each column works independently, so 7-23 means “whenever the hour part of the time is between 7 and 23 inclusive”, not “between 7:00 and 23:00”. So use 7-23 for “7:00 till midnight” and 0-6 for “midnight till 7:00”.

*/2 7-23 * * * command
*/10 0-6 * * * command
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .