Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3974

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

$
0
0
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 cur‐
rent 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.
This has never made sense to me. I do not see why it would be useful, and it is highly illogical that * has to behave differently than 1-31.

Luckily you can still check the date inside the job itself. So for the first Monday of every month:

Code:

30 9 1-7 * * test "$(date +%w)" -eq 1 && ...

Statistics: Posted by jojopi — Sat Mar 09, 2024 9:13 pm



Viewing all articles
Browse latest Browse all 3974

Trending Articles