I previously posted about a non-rsync solution to backup files.
Well, that is not efficient, (nor was it working properly, sorry). The script to create the backups is still very handy.
Using rsync to sync remote to local
rsync to sync files from remote to local and I have to admit it’s blazing easy to use.
A single line downloads the backup files to the local folder:
rsync -vzre 'ssh -i /home/backup/.ssh/id_rsa -l backup' email@example.com:/backup/system/ /backup/local/server/
-v means verbose,
-z is to compress during transfer,
-r is recursive and
-e specifies SSH.
The first path with host and user is the
SOURCE, where you take the files from, the second path is the
DESTINATION locally, where you want to put the files.
You probably have to tell it where the SSH private key is and which user to login with SSH, put that into quotes after the
Way easier than scripts that didn’t even work huh?
You can also limit the bandwidth using
--bwlimit=XX argument (it’s in Kilobyte):
rsync -vzr --bwlimit=300 -e 'ssh -i .........
When you get
Unexpected remote arg:
When you get this error, it’s due to either wrong user and/or SSH configuration.
Important is that you have the
-e directly followed by