From 7b00a6584b6d6e77c54e0f3365a898f6338d36b2 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Fri, 1 Dec 2023 14:48:23 +0100 Subject: [PATCH] Implemented backup directory validation --- cleanup.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cleanup.sh b/cleanup.sh index 3565f5d..6e580d3 100644 --- a/cleanup.sh +++ b/cleanup.sh @@ -5,7 +5,12 @@ BACKUP_HASH="$1" # Define main directory containing subdirectories to potentially be deleted MAIN_DIRECTORY="/Backups/$BACKUP_HASH/backup-docker-to-local" -echo "Checking backup directory: $MAIN_DIRECTORY" +if [ -d "$MAIN_DIRECTORY" ]; then + echo "Cleaning up directory: $MAIN_DIRECTORY" +else + echo "Error: $MAIN_DIRECTORY does not exist." + exit 1 +fi # Define trigger directory argument as TRIGGER_DIR TRIGGER_DIR="$2"