CronJobs on OSX Catalina not executing

Viewed 1425

I am aware apple has deprecated cron in favor of launchd. I want to use cron jobs over launchd because launchd does not provide the same time scheduling functionality as cron.

  • I have enabled my usr/sbin/cron to have full disk access and I have my crontab on my root user with a simple job * * * * * echo "test" in order to verify if cron is executing or not.
  • I have checked my root mail and user mail, then specified cron to mail out to a separate email with no luck.
  • I have also checked my cron.deny and at.deny files to find only Guest is unable to execute cron jobs.
  • I then created a cron.allow and at.allow files and added my user and root user to those files, still with no luck.

Does anyone have any other suggestions for getting cron jobs to execute on OSX Catalina? I am about to uninstall Catalina and install Ubuntu on the spare Mac Mini I'm using because this is so difficult to get running. Any suggestions much appreciated.

doing a sudo crontab -l | pbcopy has no output,

however doing a sudo crontab -l outputs this:

* * * * * echo "test"

I have to add sudo because the cron jobs are under the root user.

I am now able to see errors properly - my machine did not have any cronlogs, and did not have normal cron behavior of sending output to mail.

My work around was simply to create a txt file and log to it like so.

* * * * * pathtojob >> pathtologfile 2>&1

the >> indicates appending to a log file while the 2>&1 indicates to write standard out and error to that file. Thank you to those who helped me trouble shoot this.

1 Answers

You can check for errors in /var/log/cron. There might be an error there. Also are you sure the test echo script is working fine? Try executing it manually as well. It is better to redirect the output of cron job to a file. This way you can track if cron job is running by checking if the file is being populated.

Related