Skip to content

Instantly share code, notes, and snippets.

@gueno
Created February 4, 2012 14:08
Show Gist options
  • Select an option

  • Save gueno/1738030 to your computer and use it in GitHub Desktop.

Select an option

Save gueno/1738030 to your computer and use it in GitHub Desktop.

Revisions

  1. gueno revised this gist Feb 6, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Drupal Multisite Drush Script
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@ echo "8. disable specific module"
    echo -n "Input [1,2,3,4,5,6,7 or 8] ? "
    read choice

    if [ $choice -ne 6 ] ; then
    if [ $choice -gt 6 ] ; then
    echo -n "Extension (module/theme) name ?"
    read ext
    fi
  2. @invalid-email-address Anonymous created this gist Feb 4, 2012.
    47 changes: 47 additions & 0 deletions Drupal Multisite Drush Script
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,47 @@
    #!/bin/bash

    # Get all Drupal sites
    sites=`find . -maxdepth 1 -type d -print | grep -v '/all$' | grep -v '/default$' | grep -v '\.$'`

    echo "Choose the commande to execute : "
    echo "1. update"
    echo "2. put sites offline"
    echo "3. put sites online"
    echo "4. clear all cache"
    echo "5. clear css+js cache"
    echo "6. clear specific cache"
    echo "7. install specific module"
    echo "8. disable specific module"
    echo -n "Input [1,2,3,4,5,6,7 or 8] ? "
    read choice

    if [ $choice -ne 6 ] ; then
    echo -n "Extension (module/theme) name ?"
    read ext
    fi

    # For each site, execute the command
    for site in $sites
    do
    echo ----------
    echo $site
    cd $site
    if [ $choice -eq 1 ] ; then
    drush updatedb
    elif [ $choice -eq 2 ] ; then
    drush vset --always-set maintenance_mode 1
    elif [ $choice -eq 3 ] ; then
    drush vset --always-set maintenance_mode 0
    elif [ $choice -eq 4 ] ; then
    drush cc all
    elif [ $choice -eq 5 ] ; then
    drush cc css+js
    elif [ $choice -eq 6 ] ; then
    drush cc
    elif [ $choice -eq 7 ] ; then
    drush pm-enable -y $ext
    elif [ $choice -eq 8 ] ; then
    drush pm-disable -y $ext
    fi
    cd ../
    done