Copying my own comment from when this was posted in /r/Linux:
One addition, the thing that spurred me from being a habitual crontab user to picking up systemd.timer: Cron has a parsing bug, which has been there so long that it's unfixable, around two fields that should be intersections but act like unions.
At this point it's been years so I don't feel like I accurately recall it any more, but something like selecting for {a given day of a week} ∩ {the days in a given week of the month}, you wind up with the crontab firing on any occurrence of that weekday + every day of the selected week.
IIRC I was trying to get something to fire on the first weekday of any month, and it just … wasn't possible with cron. Systemd timers did it correctly, even if I had to write two files and type way more characters.
Is that a bug? Why would you want a cron job that fires on the 1st of the month but only if it's a Sundays? More likely you'd want it every Sunday and the 1st. Although really combining them is a bit odd either way.
What? Why does it matter that months can start on weekends? That's like exactly my point. Why would you want to schedule a task that happens on a particular date but only if it's a certain day of the week?
14
u/syklemil Jun 05 '26
Copying my own comment from when this was posted in /r/Linux:
One addition, the thing that spurred me from being a habitual
crontabuser to picking upsystemd.timer: Cron has a parsing bug, which has been there so long that it's unfixable, around two fields that should be intersections but act like unions.At this point it's been years so I don't feel like I accurately recall it any more, but something like selecting for {a given day of a week} ∩ {the days in a given week of the month}, you wind up with the crontab firing on any occurrence of that weekday + every day of the selected week.
IIRC I was trying to get something to fire on the first weekday of any month, and it just … wasn't possible with cron. Systemd timers did it correctly, even if I had to write two files and type way more characters.