Once you've sorted out the rsync command and run the initial backup, you need only to put the rsync command into a script and automate it with cron. To do that, you just need a text editor like Vi/Vim, Emacs or Pico.
Simply copy the rsync command(s) you used into the text editor and save it to
/backups with a descriptive name. Just remember:
sudoin the script.
--dry-runargument from the rsync command.
.shextension (it's a shell script).
Here's what a sample script might look like:
# Daily Data Backup
rsync -avz -e "ssh -i /backup/ssh_key" /home email@example.com:home-data
Once the script is saved, you need to make it executable with chmod +x file. For example:
chmod +x /backup/backup-home.sh
If you have gotten this far and it still looks like Klingon to you: firstname.lastname@example.org .
Once you have your backup script created and saved, you need only to add a cron job to automate it. To automate a cron job for your script:
sudo crontab -e
For example, to run backup-home.sh every night at 11:42 PM, you would enter:
42 23 * * * /backup/backup-home.sh
The fields in crontab (separated by s p a c e s or tabs) are:
[minute] [hour] [day of month] [month] [weekday] [command] [command args]
Should you have questions or need help: email@example.com