From ed04787e9bc4135acf32131d71dc1b8a1edd8e3a Mon Sep 17 00:00:00 2001 From: Salt Date: Sun, 3 May 2020 06:09:10 -0500 Subject: [PATCH] Check for backups dir AFTER we might've changed it --- roles/backups/templates/backup.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/roles/backups/templates/backup.sh b/roles/backups/templates/backup.sh index 0a23d81..1b93482 100644 --- a/roles/backups/templates/backup.sh +++ b/roles/backups/templates/backup.sh @@ -20,10 +20,6 @@ log() { } # Sanity checks -if ! [ -d "$BACKUPSDIR" ]; then - log "Unable to find backups directory: $BACKUPSDIR" - exit 1 -fi if ! [ -d "$MODULESDIR" ]; then log "Unable to find modules directory: $MODULESDIR" exit 2 @@ -32,6 +28,11 @@ fi if [ -r "$MODULESDIR/backuprc" ]; then source "$MODULESDIR/backuprc" fi +# More sanity checks +if ! [ -d "$BACKUPSDIR" ]; then + log "Unable to find backups directory: $BACKUPSDIR" + exit 1 +fi # Do the do log "Beginning backups" for file in "$MODULESDIR"/*; do