Tim Pickup
Tim Pickup

Reputation: 143

Cron Schedule to run every 15 minutes between certain datetimes

I've got a cron expression for running every 15 minutes:

*/15 * * * *

However, I don't want it to run between Friday 23:00 and Sunday 19:00. How could I achieve this within a cron expression? I know I can run between certain days but I can't figure out how to add a time to that.

Anyone understand the witchcraft that is cron? :(

Upvotes: 2

Views: 8840

Answers (1)

eleytheria
eleytheria

Reputation: 163

You can't do this with one cron job. You'll have to split them up.

*/15 * * * 1-4
*/15 1-23 * * 5
*/15 19-23 * * 7

https://crontab.guru really helpful for setting these up.

Upvotes: 4

Related Questions