Search code examples
croncron-taskcrontriggergoogle-cloud-scheduler

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


Solution

  • 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.