Heal Your Church WebSite


Teaching, rebuking, correcting & training in righteous web design.

Craigslist Down proves the need to plan for failure

What does the PG&E induced craigslist outage have to do with your church or charity website? How about a reminder of the tired but true adage that reads ‘Those who fail to plan, plan to fail.’ Specifically using mysqldump, crontab and perhaps ftp or rsync to insure you’re data isn’t dead in the water when your host goes down.

  • One of the big advantages of running a web services company out of the San Francisco area is that you’re located where the majority of action is – at least in the U.S.
  • One of the big disadvantages of running a web services company out of the San Francisco area is that when the Bay area takes a power hit – you’re down with the best of them.

This power-packed paragraph from the Boston Herald exemplifies the scope of the situation:

Cool black light, or dim bulb? You decide with your plan of attackAT&T Park, home of the Giants, was also affected hours before a scheduled night game. Six Apart Inc., a blog-hosting service, said its sites began failing shortly before 2 p.m., and the company sent an e-mail to customers blaming the city’s “power issues.” Several other Internet sites with San Francisco offices had problems, including Craigslist, Technorati, Yelp, Red Envelope and CNet. It was unclear whether the problems were related to the outage.

Now while I suspect the ‘big guys’ have contingency plans to quickly relocate had this been a long-term failure, I also speculate that your church and/or charity’s emergency plans may not be so robust as to handle something such as a hosting provider that goes belly-up due to either natural and/or financial disasters.

That said, there are some no-cost, low-bandwidth solutions are already available to those of you opting to manage your site’s content on a LAMP platform using an application such as WordPress or Drupal.

Here’s all you need to cook-up your own recipe for success:

  • putty for shell access to your website/host
  • access to the mysqldump command
  • optional access to the gzip command
  • your database username
  • your database password
  • your database server name
  • optional access to the crontab utility

So if nothing else, with the above you could set up a nightly job that backs up and then gzips your database all in one fell swoop:

$ mysqldump -uMYSQLUSERNAME -h localhost -pMYSQLPASSWD wp_MYDB | gzip -9 > wp_MYDB-db.sql.gz

This approach is of course not without its downside, specifically:

  • you could be potentially overwriting a good backup with a corrupted data backup
  • you still have your backup on a server that could go down
  • you have no real report as to the validity of the backup

Instead, it’s probably advisable to create a script and/or perhaps write a PERL program to enhance this process to:

  1. first grandfather the last good archive backup
  2. then archive the last good backup
  3. then add a date stamp to the file
  4. then make a copy of a successful backup to another location
  5. finally, email you and/or log the results

But who as time to write a script you ask? Well, fear not, one of the reasons I’ve filed this article under ‘resource filled’ is because I found a wonderful little service entitled: the FTP backup script generator.

You simply enter the parameters, it generates a script that you then copy and paste onto your system – then crontab to run on a nightly basis.

And if that doesn’t float your boat, here are a few other articles on the topic of how to use crontab, MySql and FTP or rSync to keep your data safe and sound now matter how badly the power fluctuates about your backup-savvy server.

  • NixCraft – How to backup MySQL databases, web server files to a FTP server automatically
  • How to have automatic backups of your mySQL database – ThemeBot
  • How To Forge: Create Incremental Snapshot-style Backups With rSync And SSH
  • MySQL backups using mysqldump by CrazyToon
  • Peter’s Blog: rSync articles by tag
  • Automated Backups on Tiger Using rsync – O’Reilly MacDev Center
  • VoorBurg: Backup script for Linux using tar and find
  • How to backup your MySQL tables and data every night using a bash script and cron – CGI Interactive
  • Old Guy’s Scripts: MySqlDump database backup script

I know we’re all busy, and I said, this approach is a mere pittance in light of true disaster recovery. That said, it is up to make sure you have at least taken the above precautions … and from there add more points and detail … for as it is written (with apologies to the inspirational text of Romans 10):

How can they restore the data without knowing how?
And how can they know how without having practiced?
And how can they practice without someone teaching them?
And how can someone teach without documentation?
As it is written, “How beautiful are the webmasters who have planned ahead!”

3 Comments

  1. Or you could download and use dbsender.

    I got ana email from 6A saying that their Vox service was down due to the power outage. (I’ve got a Vox account that I don’t use.) I was impressesed that they had a contingency set up to notify users that obviously didn’t rely on local power.

    Like the new look, BTW.

  2. Hmmm. Something about your form breaks the Google Toolbar spell checker. It just won’t check this field for some reason.

  3. My form (e.g. comments form) or the SHELL generator form I linked up (not mine, but I linked it because I liked it :-))