I have two remote servers, one running Apache and MySQL, and another Apache and Postgresql.

Using these (https://wiki.postgresql.org/wiki/Automated_Backup_on_Linux) scripts as reference, I've created two scripts for each machine that, running at every night, do a dump of the database and a copy of the websites.

The result is that, in every server, I have a /home/backups/database/mydatabase-[DATE].gz and a /home/backups/website/mysite-[DATE].tar.gz files.

Now, to finish my automated backup setup, I want to, every day, copy the new created files to my local development machine. The problem is that I don't know what to do.

As far as I know, a good approach is:

  • Create ssh keys from my local machine and install them in every server
  • Use a cronjob to run four scp commands to copy the files created the current day (scp backup@server1.com:/home/backups/database/mydatabase-\'date +\%Y-\%m-\%d'.gz, etc)

Is this a good idea, or is there a better approach? Maybe using rsync? Is it secure like ssh? I've never used it...

  • I'm not sure I understand your question fully, but check out rsnapshot. It's a really slick back-up tool that uses rsync at its core.
    – KevinC
    Feb 12 '16 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.