MacOS – rsync cron job for backup not working

backupcronmacosrsync

I'm trying to run a backup from one HDD to another at 10pm everynight on a Mac Pro. I have tested the rsync and it backups just fine outside of the cron table. Here is what I have and it's not running

* 20 * * * rsync -av /Volumes/HDD1/* /Volumes/HDDbackup/

This is on a Mac Pro that doesn't get turned off nightly

Best Answer

Assuming that /Volumes/HDD1 and /Volumes/HDDbackup are internal drives then your crontab should be:

00 22 * * * rsync -av /Volumes/HDD1/ /Volumes/HDDbackup

If one or both drives are external drives then you need to keep the external drives mounted when the user logs out. Keep in mind that macOS usually mounts external drives as noowners (set to ignore permission). You should consider enabling permissions on any external drive with the proper access for that user.

Then set the preference file-/Library/Preferences/SystemConfiguration/autodiskmount :

sudo defaults write /Library/Preferences/SystemConfiguration/autodiskmount AutomountDisksWithoutUserLogin -bool true

Note: I didn't test whether this preference file works in Sierra.