Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

run every monday at 5am

Tags:

cron

crontab

I generated a cron to run every Monday at 5am.

0   5   1   *   1

The third number, 1, for day of month, has it set to run on the first of every month as well as Monday.

Do I change that 1 to 0 so it ignores the day of month? Otherwise it will run every Monday as well as run on the 1st of the month.

like image 388
Brad Avatar asked Sep 04 '14 23:09

Brad


1 Answers

Have two entries:

to run every Monday at 5 AM : 0 5 * * 1

to run on 1st of every month at 5 AM : 0 5 1 * *

OR, if you want a single entry, the you may have to do something like: https://github.com/xr09/cron-last-sunday/blob/master/run-if-today

like image 74
slayedbylucifer Avatar answered Nov 04 '22 06:11

slayedbylucifer