From efd22958a31ca53bc680e70c9e612cd341eaf21d Mon Sep 17 00:00:00 2001 From: Salt Date: Tue, 30 Jun 2020 07:09:29 -0500 Subject: [PATCH] Ignore .backup directories that don't have anything in them --- roles/desktop/templates/backup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/desktop/templates/backup.sh b/roles/desktop/templates/backup.sh index e450f28..b863f20 100644 --- a/roles/desktop/templates/backup.sh +++ b/roles/desktop/templates/backup.sh @@ -37,6 +37,7 @@ fi for dir in /home/*; do username="$(basename -- "$dir")" [ -d "$dir/.backup" ] || continue + for file in "$dir/.backup/"*; do [ -e "$file" ] || continue; done tar czhf "$OUTDIR/desktop-$username-{{ inventory_hostname }}-$(date -Iseconds).tar.gz" "$dir/.backup/"* done