Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crontab run every 15 minutes except at 3AM?

Tags:

linux

unix

cron

Is it possible to have a cronjob run every 15 minutes (over every hour etc..) except for at 3AM?

I have another special cronjob I want to run at 3AM, but I don't want the other one to run at the same time...

like image 356
Eric Seifert Avatar asked Jan 06 '12 20:01

Eric Seifert


People also ask

How do I schedule a script in crontab to run every 5 minutes?

basic 3. /usr/bin/vim. tiny 4. /bin/ed Choose 1-4 [1]: Make a new line at the bottom of this file and insert the following code. Of course, replace our example script with the command or script you wish to execute, but keep the */5 * * * * part as that is what tells cron to execute our job every 5 minutes.

What does 0 * * * * mean in crontab?

0 * * * * -this means the cron will run always when the minutes are 0 (so hourly) 0 1 * * * - this means the cron will run always at 1 o'clock. * 1 * * * - this means the cron will run each minute when the hour is 1.


1 Answers

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:45 15-45/15 3 * * * thejob # 3:00 dead 0 3 * * * otherjob 
like image 61
fge Avatar answered Oct 27 '22 00:10

fge