Crontab run every 15 minutes except at 3AM? Crontab run every 15 minutes except at 3AM? unix unix

Crontab run every 15 minutes except at 3AM?


With one cron line, no. With three, yes:

# Every 15 minutes except for 3:00-3:59*/15 0-2,4-23 * * * thejob# 3:15, 3:30, 3:4515-45/15 3 * * * thejob# 3:00 dead0 3 * * * otherjob


I made my own solution, but I wanted to see what other people thought of!

I put this on the top of my desired script. I wanted it to not run at the half hour either so it doesn't do it on both.

On top of the script:

if [ $(date +%M) = 00 ] || [ $(date +%M) = 30 ]thenexitfi

The cron line:

*/15 * * * * ~/path/to/file

Hope anyone uses my solution too.


 0,15,30,45 0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 * * * your cron job