Site backup using rsync over ssh
I use rsync over ssh to backup files—including my entire WordPress installation—from my site to my local machine (and back). Having these tools natively in Ubuntu makes it a lot easier—not to mention similar file paths on both local machine as well as on my webhost. Here’s how I do it.
This to backup1 all files from my site to my local machine:
rsync -avz -e ssh remoteuserid@mysite.com:remotepath localpath
And from my local machine to my site:
rsync -avz -e ssh localpath remoteuserid@mysite.com:remotepath
remotepath would be something like this: /home/remoteuserid/public_html, and localpath would be like this: /home/localuserid/backup/public_html.
Damn it’s fast.
- I don’t do a cron job of a file backup and restore—I get knots in my stomach. Call it personal preference, but I prefer it manual; and this is mostly because of my file-scatter, and the state of my files, which are usually in various levels of edit—at any given point of time. [←]