I want to create a cron job that will be launched a file at 2AM Thursdays, Fridays, and Saturdays.
For some reason I get really confused doing that.
Can someone give an example on how to do this?
I want to create a cron job that will be launched a file at 2AM Thursdays, Fridays, and Saturdays.
For some reason I get really confused doing that.
Can someone give an example on how to do this?
The format of the cron
table entry is as follows:
min hr date month weekday command
So, the entry for 2AM on Thu/Fri/Sat would be:
0 2 * * 4,5,6 /path/to/command
You can also use ranges:
0 2 * * 4-6 /path/to/command
The weekday field starts with 0
on Sunday (7
is also Sunday).
Some versions of cron
will even let you spell it out:
0 2 * * Thu-Sat /path/to/command
If you want a handy tool that will explain cron table entries to you, this site might be pretty helpful.
min hour day month weekday user command
.
– user
May 16 '17 at 17:30