Browse Source

first commit

main
ppound 9 months ago
commit
1f99051941
  1. 18
      multisite-db-dump.bash
  2. 15
      multisite-drush-command.bash

18
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

15
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
Loading…
Cancel
Save