Website Backup With rsync

One thing that kept me from getting my blog back up for a while was the lack of a consistent backup strategy for the WordPress content and the website as a whole. Website backup should be easy, with these commands and the following script, it’s very easy.

This is just a starting point though, I have some ideas about backup that I plan to explore in future experiments.

Manual Runs

Quick backup command lines:

This creates a mirror image of the remote system directory tree and will delete local files that don’t exist remotely. Also, before doing the rsync it creates a dump of the MySQL database (useful for WordPressers) so you have that solidly backed up too, but you do have to punch in the password via the console. It’s a bad idea to pass the password directly on the command line, because it could be exposed to other users on a shared system.


This can be automated using a Bash script + Expect, of course. (and then stuck in a crontab)

Expected output from the script

Leave a Reply

Your email address will not be published. Required fields are marked *

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