|
|
|
|
@ -1,10 +1,10 @@
|
|
|
|
|
#!/usr/bin/env bash |
|
|
|
|
# usage ./mulitsite-drush-command.bash path_to_sites_directory command |
|
|
|
|
# usage ./mulitsite-drush-command.bash path_to_sites_directory command "paramters" |
|
|
|
|
# path_to_sites_directory is the full path drupals sites directory (something like /var/www/drupal/web/sites) |
|
|
|
|
# and command is a drush command |
|
|
|
|
#switched to actual directories instead of symlinks as we have multiple symlinks for some production directories |
|
|
|
|
#excludes the all and the current directory (.). |
|
|
|
|
[ $# -ne 2 ] && { echo "Usage: $0 path_to_sites_directory drush_command"; exit 1; } |
|
|
|
|
[ $# -lt 2 ] && { echo "Usage: $0 path_to_sites_directory drush_command"; exit 1; } |
|
|
|
|
cd "$1" |
|
|
|
|
pwd |
|
|
|
|
list="$(find ./ -maxdepth 1 -type d)" |
|
|
|
|
@ -13,7 +13,7 @@ for link in $list ; do
|
|
|
|
|
cd "$link" |
|
|
|
|
#pwd |
|
|
|
|
echo "Executing Drush command '$2' for site: $link" |
|
|
|
|
../../../vendor/bin/drush "$2" --yes |
|
|
|
|
../../../vendor/bin/drush "$2" $3 --yes |
|
|
|
|
if [ $? -ne 0 ]; then |
|
|
|
|
echo "Error: Drush command failed for site: $site_name" |
|
|
|
|
fi |
|
|
|
|
|