From 35e28f31d2844d53dddd0b6cc81c429c3b969a7e Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 11 Jan 2024 11:04:03 +0100 Subject: [PATCH] Changed logic so that volume is not created for db recoveries --- recover-docker-from-local.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/recover-docker-from-local.sh b/recover-docker-from-local.sh index 5ed9879..a6e8de1 100644 --- a/recover-docker-from-local.sh +++ b/recover-docker-from-local.sh @@ -22,9 +22,7 @@ backup_folder="Backups/$backup_hash/backup-docker-to-local/$version/$volume_name backup_files="/$backup_folder/files" backup_sql="/$backup_folder/sql/$database_name.backup.sql" -echo "Inspect volume $volume_name" -docker volume inspect "$volume_name" -exit_status_volume_inspect=$? +# DATABASE RECOVERY if [ -f "$backup_sql" ]; then if [ -n "$database_container" ] && [ -n "$database_password" ] && [ -n "$database_name" ]; then @@ -40,6 +38,12 @@ if [ -f "$backup_sql" ]; then exit 1 fi +# FILE RECOVERY + +echo "Inspect volume $volume_name" +docker volume inspect "$volume_name" +exit_status_volume_inspect=$? + if [ $exit_status_volume_inspect -eq 0 ]; then echo "Volume $volume_name already exists" else