As I am now hosting about 8 different sites I was wanting to make restoring from backups a bit easier and less manual. The ultimate goal is to login to my second server and have it up and running with as few key-strokes as possible. Scripting was the answer. It took me several hours of fanangling with syntax in a scratchpad and digging through google to finally put this together. I am sharing my completed work here for anyone else that could possibly make use of it as a spring-board for automating their own restoration process. I just got a new/upgraded backup server so it seemed like a good time to straighten it all out again and streamline things even more.

This is somewhat of a continuation from my earlier posts on automating “off-system” database backups. You can read those posts here:
mysql-database-backup-shell-scripts-that-can-be-run-as-cron-jobs

Setting up automated database backups for your WordPress, Drupal, or Joomla website

Background:

I have two servers. One server is my primary server that hosts all of my live sites.

The second server is a backup server that I pull a copy of my web directory (with sub-directories for each site) and a compressed database dump of each database. (more…)