Browse Source

added check for settings php

main
ppound 6 days ago
parent
commit
81c32cc704
  1. 9
      multisite-db-dump.bash

9
multisite-db-dump.bash

@ -6,16 +6,17 @@
#excludes the all and the current directory (.).
[ $# -ne 1 ] && { echo "Usage: $0 path_to_site_directory"; 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"
filename=$(basename "$link")
echo "backing up database for site: $filename"
../../../vendor/bin/drush sql-dump --result-file=/var/www/backups/db-dump-"$filename"-$(date +%F).sql
if [ $? -ne 0 ]; then
if [ -f "./settings.php" ]; then
echo "backing up database for site: $filename"
../../../vendor/bin/drush sql-dump --result-file=/var/www/backups/db-dump-"$filename"-$(date +%F).sql
if [ $? -ne 0 ]; then
echo "Error: Drush command failed for site: $site_name"
fi
fi
cd "$1"
fi

Loading…
Cancel
Save