Web Design

Auto Update Drupal Multisite

I was recently talking with the fine folks at UCSF.edu and they mentioned that they do updates of giant Drupal multisites.  I asked them how they manage that.  The answer: a script!  So of course I wanted one too.

<--break->

Here are my steps:

  1. Create a bash script in your home directory (or somewhere outside your web root)
  2. Make the script executable: sudo chmod +x myscript
  3. Put the following code inside your script:
#!/bin/bash

echo "Jordan's Magicalal Interactive Drupal Updater"

# Set sites in an array sites=( bash array goes here )

cd /var/www/d7
for this in ${sites[*]}
do
  echo $this
  cd /var/www/yourdrupaldirectory/sites/$this
  drush up
  drush updb -y
done