If you have two servers, could be a good idea to make cross backups of the important data, so if any of them fails you can always restore from the other.

Here we will use rsync and ssh to make this possible, rsync is used to sync files between folders on the same machine or between machines, ssh will open an encrypted tunnel so the data could be secure on the transfer. We will have the option to make this automatic using a cron job

Enable the ssh login with no password

I have written how to do this in the past, so you can go to this link to make it and go back once it is finished, if you do not need to automate this process you don’t need this step.


Prepare the backing machine

In the machine where the files are going to be copied, enter this commands

cd $HOME mkdir backup

Create the script

This script will run on the backing machine.

#Backup your files with automatic incremental
#Delete the files on destination that have been
#deleted on the source
rsync -e 'ssh -ax' -avz --delete --delete-excluded backed.server:/source/directory $HOME/backup/

Make this script to run in a CronJob as your user (not root, unless you want that) if you do not want this automatic, run by hand each time you want to back up your files.