commit 1f9905194194cad9aed30052540b3f7016ecb7e9 Author: ppound Date: Thu Apr 3 09:45:37 2025 -0300 first commit diff --git a/multisite-db-dump.bash b/multisite-db-dump.bash new file mode 100755 index 0000000..2ae3280 --- /dev/null +++ b/multisite-db-dump.bash @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# usage ./mulitsite-db-dump.bash path_to_sites_directory +# path_to_sites_directory is the full path drupals sites directory (something like /var/www/drupal/web/sites) +# This script will get the symlinks in the sites directory cd into the symlink directory and run drush sql-dump +# for this to work we need sites to be symlinked and no file symlinks is the site directory +[ $# -ne 1 ] && { echo "Usage: $0 path_to_site_directory"; exit 1; } +cd "$1" +pwd +list="$(find ./ -maxdepth 1 -type l)" +for link in $list ; do + cd "$link" +# pwd + filename=$(basename "$link") + ../../../vendor/bin/drush sql-dump --result-file=/var/www/backups/db-dump-"$filename"-$(date +%F).sql + cd "$1" +done +exit + diff --git a/multisite-drush-command.bash b/multisite-drush-command.bash new file mode 100755 index 0000000..c9e08c3 --- /dev/null +++ b/multisite-drush-command.bash @@ -0,0 +1,15 @@ +#!/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 +[ $# -ne 0 ] && { echo "Usage: $0 path_to_sites_directory drush_command"; exit 1; } +cd "$1" +pwd +list="$(find ./ -maxdepth 1 -type l)" +for link in $list ; do + cd "$link" + pwd + ../../../vendor/bin/drush "$2" --yes + cd "$1" +done +exit