diff --git a/multisite-db-dump.bash b/multisite-db-dump.bash index 632fbd8..a065f08 100755 --- a/multisite-db-dump.bash +++ b/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