Simple rsync based backup script

This simple bash script is able to backup all given files and folders to a backup destination. I use it to backup all my Raspberry Pis, Banana Pis and also my notebook to my Synology NAS.

Example call:

If you want to run it as a crontab, you can use key based authentication (see SSH key authentication).

The script is also able to ignore defined source paths based on a exclude list. On Ubuntu for example the following  files and folders have to be excluded in a backup to be able to boot from the backup in a case of disaster recovery. That’s why they are listed in the exclude.txt:

Permission errors

If you got permission errors like this,

you probably don’t have the the rights to change the users or permissions on the target host. The errors occurs because rsync tries to assign the same users, groups, timestamps and permissions to the files and folders on the target system as they are set on the source system.

The solution is, to change the rsync-parameters like that:

Leave a Reply

Your e-mail address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.