my WordPress backups strategy – pebkac

my WordPress backups strategy

As mentioned previously, I had a major backups fail with this blog. I’ve now implemented a backups strategy that meets my needs, so I thought I would put together a post documenting what I did.

Step one (1) is local backups of the WordPress database. There are any number of ways to do this, including some well-reviewed plugins like this one. Given that I have shell access to the machine running this blog and full control over things like cron, I figured I would use this as an exercise and write my own little shell script to do the work.

Step two (2) is what I ignored last time, and that’s getting both the database and the wordpress directory (wordpress itself, templates, uploads, etc.) off site. For that I’ve used rsnapshot, which I installed via apt-get on a machine that is NOT the blog host. I decided to put the hourly/daily/weekly/monthly crontab lines in my own personal crontab on the rsnapshot host. One of the reasons for this is that I might decide to make more extensive use of rsnapshot later, and I’d like to keep the WordPress backups separate. The one caveat with doing this is that it assumes access to an SSH key and the SSH_AUTH_SOCK from my tmux session, so if my session dies, backups stop working. Given that I use this machine on a daily basis, that is not a major concern. Still, a better way to do this would be to create a dedicated, unprivileged backups user that would run rsnapshot from its crontab. Then on the blog host, I’d have a matching unprivileged user with access to the target directory for the database backups. I decided against doing that work because both of these machines are fairly restricted to begin with (nobody else has shell login, reasonable update schedule, etc.) and it seemed like overkill for blog backups.

4 responses to “my WordPress backups strategy”

  1. Why is it that everyone always seems to want to reinvent the wheel? Yay, you can write a script to do what you want, but good grief, aren’t there better things you can spend your time on? The WP-DB-Backup plugin is what I use and I have it on a weekly schedule automatically back everything up and email it to my Google mail account. Voila, instant off-site backups without having to reinvent the entire process all over again.

  2. I’m sorry my choice of how to spend my free time doesn’t live up to your high standards. I’ll do better next time. I could leave a condescending comment on your blog, for example.

  3. I wasn’t trying to be condescending. NIH syndrome is a huge problem with many companies these days and you’ve simply proved the case.

  4. Actually by meeting my WordPress backups needs with shell scripts while having a beer after supper, I’ve proved that extensive use of off-the-shelf software is a huge problem with many companies.

    I feel compelled to point out that the above statement uses flawed logic that parallels your own for the sake of parody.

    I note that you don’t deny that your comment was condescending. I’d appreciate it if you’d take the extra 30 seconds to read your own comments before posting them. When you do so, consider how they will be received. Not only are you less likely to offend, but any message you wish to convey is more likely to be heard. I, for example, have LESS confidence now that you are a good judge of what is wrong with how software is deployed and/or developed in many companies, because from my perspective you attacked my sharing of my personal software-related story for no decent reason and without a strong grasp of the facts or even an effort to gain the facts. I looked at the very plugin you mention. I even linked to it in the body of my post. Did you ask me why I decided it wasn’t for me? Nope. So yes, you were condescending, and no, I’m not interested in what you think you or I have proved. If you want to continue talking about Not-in-House issues or backups, you can do it on your own blog, but not here.

This work by tarheelcoxn is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States.