Thursday, February 8, 2024

[SOLVED] run every monday at 5am

Issue

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.


Solution

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



Answered By - slayedbylucifer
Answer Checked By - Mildred Charles (WPSolving Admin)