If you’re like most people, you probably don’t have a lot of time on your hands. You work all week, and then you have to spend the weekend doing things that don’t require your time. But if you want to run a Cron Job on Sunday or any other day, it’s not too hard. Here are some tips:
- Make sure that your computer is up and running. This is important because Cron Job will need to send commands to your computer in order to run.
- Make sure that your internet connection is good. This is also important because Cron Job will need to send commands to your internet service in order to run properly.
- Make sure that you have a valid email address for Cron Job purposes. This is important because CronJob will need to send commands to your email in order to run correctly.
- Make sure that you have a valid username and password for CronJob purposes. These are important because they will be needed when you sign in for the first time when CronJob starts up.
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.