Some scripts to help with drush path in general and our islandarchives2 multisite install.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
884 B

#!/usr/bin/env bash
# usage ./mulitsite-drush-command.bash path_to_sites_directory command
# 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; }
cd "$1"
pwd
list="$(find ./ -maxdepth 1 -type d)"
for link in $list ; do
if [ "$(basename "$link")" != "all" ] && [ "$(basename "$link")" != "." ] ; then
cd "$link"
#pwd
echo "Executing Drush command '$2' for site: $link"
../../../vendor/bin/drush "$2" --yes
if [ $? -ne 0 ]; then
echo "Error: Drush command failed for site: $site_name"
fi
cd "$1"
fi
done
exit