Changed logic so that volume is not created for db recoveries

This commit is contained in:
Kevin Veen-Birkenbach 2024-01-11 11:04:03 +01:00
parent 15a1f17184
commit 35e28f31d2

View File

@ -22,9 +22,7 @@ backup_folder="Backups/$backup_hash/backup-docker-to-local/$version/$volume_name
backup_files="/$backup_folder/files" backup_files="/$backup_folder/files"
backup_sql="/$backup_folder/sql/$database_name.backup.sql" backup_sql="/$backup_folder/sql/$database_name.backup.sql"
echo "Inspect volume $volume_name" # DATABASE RECOVERY
docker volume inspect "$volume_name"
exit_status_volume_inspect=$?
if [ -f "$backup_sql" ]; then if [ -f "$backup_sql" ]; then
if [ -n "$database_container" ] && [ -n "$database_password" ] && [ -n "$database_name" ]; then if [ -n "$database_container" ] && [ -n "$database_password" ] && [ -n "$database_name" ]; then
@ -40,6 +38,12 @@ if [ -f "$backup_sql" ]; then
exit 1 exit 1
fi 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 if [ $exit_status_volume_inspect -eq 0 ]; then
echo "Volume $volume_name already exists" echo "Volume $volume_name already exists"
else else