rsync
This post intends for periodically syncing files onto a NAS.
Ignore Files
List all ignored files in an ignore file:
Then specify rsync command with --exclude-from=.rsyncignore
option
Final Example
Add Crontab
To run the command periodically, we setup a cron job using crontab -e
, add following command
0 * * * * rsync -avz -e ssh --delete --exclude-from=.rsyncignore . nas:/volume1/Documents/ziyue/server-backup
The first 0
means that this cron job will be executed at the beginning of every hour.