Drupal Database Maintenance Script

The attached script is a perl version of some popular Drupal MySQL database optimizations plus a mysqldump. I added some extra stuff. I suppose it might work on a Microsoft OS, but I didn’t check into it at all.

Please note: The script is dual licensed.

-If you are using it for your non-revenue producing Drupal site, then the script is distributed under the terms of the GNU GPL v3.0.

-If you are using it in a revenue-producing site, then please leave your email address in the comments to arrange Paypal payment of $20.  If you can’t come up with this script on your own then $20 is a bargain. I’m available for modifications to make it work better for your environment on a small-time contract basis.

This script is provided AS IS.  There are NO warranty or usefulness claims.

The only thing you need to do is to change some variables on the top of the script and set up a cron job to run it.

There are some consequences to using this script for which you need to be aware.

  1. Pay attention to permissions/privileges on the path for dumping the database.
  2. It makes database backups named YEARMONTHDAY.dump to the path of your choice. Delete old backups with cron. Test the backups.
  3. This script shuts down your site temporarily when it re-indexes. MySQL has to have full lock on the database. The script then turns your site back on the moment it is done.
  4. There’s some cruft-cleaning that goes on with this script.  I’m not sure how well it works for others, but it works for me.  You were warned!

Assuming you have read and understand the hazards of what was just written here is the script: drupal-db-maint.txt

Questions, comments can be submitted as comments.