If you read my blog, chances are you are aware of this new fad called the internet, and this new language called PHP. You’re also probably aware of things like MySQL and SQL, and the importance of data to visitors of your website. So, keeping that in mind, I’d also like you to know about backing up this data.

As I grow my business, the number of clients I run into that do not do backups, astounds me. I’m not talking about end user laptops/desktops, but rather backups of their SugarCRM database, or their file server, or even their company website, which is powered by Drupal/Wordpress/CMS Du Jour. When, not If, the database is corrupted, or the disk fails, they have no idea what they would do then. They just hope that it doesn’t happen to them.

So I did some thinking, and decided I should write a post, and make available to the world, a simple script, which I believe will at least give you onsite backups. This is what the script does:

  • Backs up each mysql database into it’s own little .sql file.
  • Makes a tar ball of the .sql files.
  • Copies this tarball to a remote server of your choice. (optional/requires more than editing a few lines)

The script is available to download/view here.

Change the configuration options at the top of the file, make sure everything works, and then put it in your cron. Feel free to post questions/comments in the comments section.