I have recently switched from Ubuntu to MacOS. I tried to run the exact same cronjobs I ran on Ubuntu before, however they don't, and after trying to figure out if the crontab entries might have any errors, I more and more had the suspicion that cronjobs don't run on my MBP at all, so I added this line to crontab -e
:
*/15 * * * * touch /Users/<my-user>/cronjob-success-"$(date +%Y%m%d)".txt
I'd expect it to run every 15 min (xxh15, xxh30, ...), however no new files appear. I also don't see any logs indicating cronjob runs.
The file exists in /usr/lib/cron/tabs/<my-user>
. What am I doing wrong that this doesn't work?
I am on Catalina 10.15.6
cron
treats%
characters in the command as line delimiters; you need to escape them like ...date +\%Y\%m\%d
... for the command to work.