I needed to setup a cron job to perform some maintenance which I wanted to automatically run on Sunday night since that’s usually a low traffic period. After looking up the right syntax in the manual for the eleventy-hundredth time, I realized I hadn’t written anything in a while, and I should probably jot this one down for later.
The normal syntax for a cron job item is usually right there in the editor window in a nearly unreadable dark blue font, but after using vim’s set background=dark option, turns into a nice light blue.
Based on that last line, the syntax is…
And that means a cron job line that runs every Monday at 1:05 AM would then be structured like this:
That “dow” option stands for “day of week” and is a number from 0 to 7, with the week starting and ending on Sunday. So here’s the listing:
0 – Sunday 1 – Monday 2 – Tuesday 3 – Wednesday 4 – Thursday 5 – Friday 6 – Saturday 7 – Sunday
Bottom line, if you want something to run on Sunday you can either use 0 or 7 in the “dow” column.