Drush multisite upgrade script

No votes yet

Here is a small script for mass updating a Drupal multisite using drush.

This script, when run from Drupal root, will search for valid sites inside the sites folder and the perform a code and DB update on each one of them.

 

#!/bin/bash
 
for site in `ls sites`
do
        if [ -f sites/$site/settings.php ]
        then
                echo "=============== $site ==============";
                drush -l $site updatedb;
                drush -l $site up;
        fi
done

A variation of this script can be used to run a drush command on all sites

#!/bin/bash
 
for site in `ls sites`
do
        if [ -f sites/$site/settings.php ]
        then
                echo "=============== $site ==============";
                drush -l $site "$@";
        fi
done
glqxz9283 sfy39587stf02 mnesdcuix8
sfy39587stf03
sfy39587stf04