Top Tags

Using drush to update sites

Having a few sites to update after each module upgrade prompted me to start using drush to help me. I have a few D6 web sites and a growing number of D7 sites. The following script helps me to update the database for all sites when needed.

#!/bin/sh

d6=/home/me/www/drupal-6.5
d7=/home/me/www/drupal-7

for site in `find ${d6}/sites/* -maxdepth 0 -type d` 
do
  uri=`echo $site | cut -d / -f 8`
  if [ "${uri}" != "all" ]
  then
    ${d6}/sites/all/modules/drush/drush -l http://$uri -r ${d6} -y updatedb
  fi
done

for site in `find ${d7}/sites/* -maxdepth 0 -type d` 
do
  uri=`echo $site | cut -d / -f 8`
  if [ "${uri}" != "all" -a "${uri}" != "default" ]
  then
    ${d7}/sites/all/modules/drush/drush -l http://$uri -r ${d7} -y updatedb
  fi
done