How to Back Up Your WordPress Website, Automagically!

I maintain several WordPress-based websites, all of which are, well, important to me, including this one, and it would seriously stink if something happened to any of them. Jason Tarasi posted a great how-to at ProBlogger.net with easy instructions for backing up a WordPress blog using the uber-simple WP-DB-Backup plug-in. I installed the plug-in, and my WordPress installations started emailing me daily copies of their databases. Awesome.

But what to do with these backup copies? Well, I have a Dropbox account (that’s my referral link) that I can use for safekeeping. Dropbox is a great app that lets you synch files and folders on your hard drive with an online file-sharing service, even keeping files synched across multiple computers if you want. You can share files and folders with others, so, for example, your wife and you could use it to work on your Christmas letter. Each time one of you made a change, it would be synched across all computers. It’s great for larger documents or things that are more complicated than Google Docs can handle.

So I have a place to store my WordPress backups, but I don’t really want to manually save the new backups every time they arrive. How could I make this process automatic and invisible?

After several failed attempts, here’s the process I created.

When new backups arrive, I’ve created a rule in Mail.app that shuffles them into their own folder, so that I never have to see them. That was easy, because all of the emails are from “WordPress” and include the word “Backup” in the subject.

I tried to create an Applescript to save the attachment to my Dropbox folder, but Applescript doesn’t work too well with Mail.app attachments. Instead, I created a new Application in Automator that would:

  1. Find mail messages in the new “WordPress Backups” folder I created.
  2. Filter those messages to deal only with any messages that arrived today.
  3. Save the mail attachment to my Dropbox folder

This is important: I saved this Automator workflow as an application, so that iCal could open it. Here’s a version you can use. Just change the mail folder and the destination folder, and save it as an application.

Last step: I created a recurring event for every evening at 11pm. In iCal, you can set the alarm to open an application, so I just set it to open and run this new, hyper-specific application each day. (I also use this application-as-alarm feature to automatically open Skype or iChat if I have an online meeting scheduled with someone.)

In theory, I should never have to worry about my WordPress backups. Even if something happens to my computer, they’ll be accessible from “the cloud” via Dropbox. The backup files are very small (less than 1 MB), so Dropbox ought to be able to hold as many as I need. I let you know in a few weeks if it seems to be working correctly.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s