Quantcast
Viewing all articles
Browse latest Browse all 5331

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

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.

Trouble is there isn't an easy answer and without respec'ing crontabs some sort of decision had to be made and I guess this one was inherited from early unix. Taken purely at face value, it's impossible to say if 30 4 1 * 6 means do something on the first of the month but only if it's a Saturday or whether it's first of the month and every Saturday. Much better to pick a rule and enforce it in all cases.

Though I admit that I've not tried, say, 30 4 [1-7] * 6 so can't comment on whether that means the first Saturday in the month or the first seven days of the month and every Saturday.

Cron just isn't up to doing some timings and you have to do them at the start of whatever script you're calling.

Statistics: Posted by thagrol — Sat Mar 09, 2024 11:49 pm



Viewing all articles
Browse latest Browse all 5331

Trending Articles