In search of the most convenient and cost-free backup solution, I ended up using BackupPC. Sure, it’s not the easiest path to take, but as soon as you manage to install and configure it, you set it and forget it.

BackupPC will keep daily incremental backups of as many servers as you like, it has a web interface which allows you to compare and restore files with a few clicks, it is self-hosted, so you don’t rely on a third party service and, on top of all that, it is free.What you can’t have with BackupPC, thought, is database backups.

To deal with the issue, I took advantage of the awesome WP-CLI and made a small shell script which automatically backs up all the WordPress databases of my server. More specifically, the script will search for all WordPress installations under a given directory and will backup their databases. You can declare more than one such directories and you don’t have to modify the script every time you add a new site. As long as the new site is under a declared parent directory, its database will be backed up. After creating the file, don’t forget to make it executable by doing: chmod +x wp-cli_batch_db_backup.sh. Also, you might want to add this in a cron job for scheduled backups.

Here’s the script:

Leave a Reply

Your email address will not be published.

We use cookies. By browsing our site you agree to our use of cookies. Read moreAccept