Search code examples
cronraspberry-pi

Raspberry Pi 6.1.0 OS Cron Job Configuration Issue: Running Twice on Different Dates


I'm facing an unexpected behavior with cron job configuration on my Raspberry Pi running OS version 6.1.0. When setting up a one-time cron job with specific parameters for both the day of the week and the day of the month, it appears that the day of the week parameter is overriding the day of the month.

For clarity, I configured a cron job using the following settings: 06 21 2 3 6, intending for it to execute at 21:06 on the 2nd of March, a Saturday. However, I observed that the job ran not only on the 2nd of March but also on the 9th of March, which is still a Saturday.

Has anyone else encountered this issue before?


Solution

  • man 5 crontab wrote:

    Note: The day of a command's execution can be specified by two fields — day of month, and day of week. If both fields are restricted (ie, aren't *), the command will be run when either field matches the current time. For example, ``30 4 1,15 * 5'' would cause a command to be run at 4:30 am on the 1st and 15th of each month, plus every Friday.