Drupal Script Library

I have created a nifty set of scripts for managing collections of Drupal installations.  I find them indispensable for maintaining a large stable of Drupal sites. The scripts allow for automated install and patching of Drupal installations as well as a host of other administrative tasks.  They enforce and leverage my best practices for Drupal deployments.  They extend Drush to make things easier (at least for me).

See the README for full information on the scripts within the library as well as usage guidelines:

The scripts themselves can be seen here:

and can be checked out (read only) with the command:

$ svn co "http://svn.toddgee.com/drupalScripts" drupalScripts

Enjoy!  And give me feedback/suggestions/patches by leaving a comment below.



Free Tag:


I can't get drupalBackup.sh to find my Drupal install. I tried: drupalBackup.sh default /home/htdocs/ssdev and get ** Error with specified install: Site install directory '/home/htdocs/ssdev/default' does not exist My paths are as follows:

  • Drupal core is installed in /home/htdocs/ssdev.
  • The site I want backed up is in /home/htdocs/ssdev/sites/default.

Then I tried drupalBackup.sh default /home/htdocs/ssdev/sites which outputs ** Error with specified install: Site settings file '/home/htdocs/ssdev/sites/default/sites/default/settings.php' does not exist Respond to: nonzero (at) gmail

The Drupal Script Library follow a strict naming convention that allows the structure to be leveraged to pull off all the neat tricks that it does.  In your case, you were setting the DRUPAL_INSTALL_ROOT to '/home/htdocs/ssdev' by specifying it on the command line.  It was looking for the drupal installation named 'default' in this directory which it was unable to find.  Try:

$ drupalBackup.sh ssdev /home/htdocs

(or set $DRUPAL_INSTALL_ROOT=/home/htdocs and omit the last parameter.)  Note, however, that the scripts will look for the site configuration file to be in /home/htdocs/ssdev/sites/ssdev (and not ..../sites/default) -- this is the convention.

Your best bet is to re-install Drupal with the command:

$ drupalCVSDeploy.sh install drupal ssdev.com /home/htdocs

(substitute correct domain name in for 'ssdev.com'...)  After this is done, move your settings.php file from
/home/htdocs/ssdev/sites/default/settings.php to
and re-install any contrib modules you have installed w/ subsequent calls to drupalCVSDeploy.sh

hope this helps....

Check out drush.

In fact, I use it (see the script drupalManageDrush.sh).  I use it mainly to run the dbupdate command. 

I do think my scripts work better at doing standard tasks than Drush.

Many thanks for making these available - they have made many administrative tasks easier, and I appreciate the "one installation per site" philosophy (as an admin trying to migrate an inherited Aegir installation to single-site installs, the multi-site issue one I've been frustrated by). I do have a rookie question: how do you deal with automation of the scripts, particularly with cron? I've been trying to get drupalRunCron.sh to run as a cron job (and plan to use the backup scripts, too, at some point) but the script never actually hits the cron pages. It runs, but my system email just contains the last line of output, "** Done." I suspect this is due to cron not being able to make use of the environment variables/path settings required by the script library (I've tried it with my personal crontab, and my account has these settings, but no luck) . Any tips? Thanks again.

It sounds as if the cron system is running w/o running the necessary bash setup files and thus cannot find the drupal installations.  Try using the optional last parameter on the drupalRunCron.sh command line -- the one that sets the Drupal installation group root dir.  After doing that see if the script doesn't see your set of installations.


The Drupal Script Library is currently broken because of the migration of the Drupal projects (core and contributed projects) from CVS to Git.

I will be dealing with this when I get a chance.

I have checked in the first wave of commits to make these scripts work with git.  The scripts now do a git checkout of Drupal and contributed modules.  Updates also work.  Things that are still broken are denoted with TODOs.

Moving on to using Drush to download modules.  The Drupal Script Library still provides value add, however.

See: http://toddgee.com/node/75

Is there a way to download the entire set of Drupal scripts?

Sure.  The best way is to to use the svn command above.

I suppose you could download them one-by-one via http (or use the firefox plugin like 'DownloadThemAll').  You could even write a bunch of 'wget' commands....