Ignore .backup directories that don't have anything in them

This commit is contained in:
Salt 2020-06-30 07:09:29 -05:00
parent 19908fea0b
commit efd22958a3

View File

@ -37,6 +37,7 @@ fi
for dir in /home/*; do for dir in /home/*; do
username="$(basename -- "$dir")" username="$(basename -- "$dir")"
[ -d "$dir/.backup" ] || continue [ -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/"* tar czhf "$OUTDIR/desktop-$username-{{ inventory_hostname }}-$(date -Iseconds).tar.gz" "$dir/.backup/"*
done done