Configure cron jobs in macOS

We will use the crontab command to schedule a daily backup of important files on our Macintosh.

  • Open a terminal window
  • If you only need access to your personal files continue to the next step
    • To be able to access protected files too, switch to sudo with
      sudo -i
      and enter your password.
  • Execute the command
    crontab -e
  • The VI editor opens, enter the scheduling command.
    This example runs every day at 11:00 pm, changes to the backup_scripts directory, executes the daily_backup.sh script and saves the cron logs in the /tmp directory
    0 23 * * * cd ~/Git/_Work/BACKUPS/backup_scripts && ./daily_backup.sh 2>&1 >> /tmp/cron.log

Leave a comment

Your email address will not be published. Required fields are marked *