How to run crontab job every week on Sunday

dev_fight picture dev_fight · May 23, 2013 · Viewed 437.2k times · Source

I'm trying to figure out how to run a crontab job every week on Sunday. I think the following should work, but I'm not sure if I understand correctly. Is the following correct?

5 8 * * 6

Answer

Bjoern Rennhak picture Bjoern Rennhak · May 23, 2013

Here is an explanation of the crontab format.

# 1. Entry: Minute when the process will be started [0-60]
# 2. Entry: Hour when the process will be started [0-23]
# 3. Entry: Day of the month when the process will be started [1-28/29/30/31]
# 4. Entry: Month of the year when the process will be started [1-12]
# 5. Entry: Weekday when the process will be started [0-6] [0 is Sunday]
#
# all x min = */x

So according to this your 5 8 * * 0 would run 8:05 every Sunday.