Cron Schedule to run every 15 minutes between certain datetimes

2.8k Views Asked by At

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? :(

1

There are 1 best solutions below

2
eleytheria On BEST ANSWER

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.