Automating the Backup Process (30+ websites)

I run an increasing number of WordPress sites, as well as several for clients – and logging in to perform upgrades is becoming tiresome. I’m looking for a means of automating the process, preferably from a single command line script – and upgrading all the sites in one fell swoop.

My ideal would be to hook into the very good automatic backup that’s built into WordPress, and trigger it from the server for all 30 sites. That would cover file updating and then the database.

Read More

All the websites I have backup every 24 hours so backing up before the upgrade starts isn’t a priority (but you can never have too many backups!) however, a means to determine whether a site has broken would be another interesting feature.

Assuming that I can’t hook directly into the built in backup, I found this which more or less operates in the way I was thinking, but doesn’t perform the database upgrades. I understand that this could potentially leave the website vulnerable until an administrator logs in and performs the update (which could be up to 72 hours).

I’m also familiar with the concept of using SVN and GIT to perform the updates, but if I were to move down this route I need to find a reliable way of ensuring that a) /wp-content files aren’t damaged and b) file permissions for the whole site are conserved (if the script is run as the root user).

Related posts

Leave a Reply

5 comments

  1. I’m not sure if this will address your issue…
    But there’s something new in WorldWordPress.

    http://infinitewp.com/

    It’s akin to ManageWP, but free :o)

    I’m not affiliated with them in any form, just starting to play with it.
    (ht: wpmail.me)

    It’s a platform that you install in your server.
    Add the client plugin to your WPs.
    And update/backup everything from IWP dashboard.
    Multisite support is in a single site basis.
    & +1+ had an connection issue that was promptly solved in their support forum.

    Apparently, they’ll earn revenue selling add-ons, but none is available yet.
    I suspect (and hope) they’ll be majors in no time :op

  2. An increasingly popular paid solution if ManageWP.com. I haven’t used it nor am I affiliated with it, though I plan to try it out soon. It’s aimed at this exact scenario (one-click upgrades for multiple sites across different servers). If you’re looking for a custom solution, this obviously isn’t it, but I’ve heard good things about this service.

  3. I use the SVN approach for making most of my “separate” sites now, although really I tend to use multisite more often.

    The trick, I find, is to make sure that you have the whole site in an SVN somewhere, with WordPress as an external. The key to this is to get all your changes to the site (plugins, themes, custom content, etc) outside of the main WordPress directory.

    I go into more detail on this on my writeup here:

    http://ottopress.com/2011/creating-a-wordpress-site-using-svn/

    The gist of it is that you:

    1. Create an SVN directory for the site.
    2. Setup the /wp directory as an external.
    3. Modify a custom wp-config.php to move the content directory outside of the /wp directory.
    4. Use .htaccess rewriting to change the URLs to work appropriately.

    To “backup”, you basically just commit any changes you made in the content directory (you never touch the core wp directory). This is somewhat up-for-adjustment, since maybe you don’t want to auto-commit uploaded images and such into your main SVN, in which case you would add exclusions to the uploads directory.

    To “upgrade”, you just do an svn up over the whole thing.

    This isn’t a perfect solution, but it can be scripted or even run via cron, if you so choose. If you’re scripting it, you can manually call the upgrade.php?step=1 URL in case the DB needs an update as well. If the DB doesn’t need an update, then that call will simply do nothing at all.

    Backing up your databases is a whole other kettle of fish.

  4. One solution, that may or may not work for your specific use case, is to manage the sites you run as a Multi-Site Network. That way, you update core, Plugins, and Themes only once, via the Network Admin.

  5. I specifically created Backup Box to address this issue. I have 80+ websites that needed backing up and there’s nothing really suitable to cover it.

    Check us out, https://mybackupbox.com. You can created multiple scheduled transfers to handle all your sites/databases.