Add some logging

This commit is contained in:
Salt 2020-07-11 09:03:38 -05:00
parent 6da299c1df
commit 6210946589

View File

@ -41,6 +41,7 @@ for dir in /home/*; do
for file in "$dir/.backup/"*; do [ -e "$file" ] || continue; done
tar czhf "$OUTDIR/desktop-$username-{{ inventory_hostname }}-$(date -Iseconds).tar.gz" "$dir/.backup/"*
if (( "$(date +%d)" == "1" )) || [ -f "$forcefile" ]; then
log "Detected conditions for monthly dump"
if command -v aws > /dev/null 2>&1 && aws s3 ls "s3://$s3bucket " > /dev/null 2>&1; then
# Time for huge backups piped straight to S3
tar \
@ -57,6 +58,8 @@ for dir in /home/*; do
--recursive \
--only-show-errors \
--store-class STANDARD
else
log "Could not satisfy requirements for AWS CLI"
fi
[ -f "$forcefile" ] && rm "$forcefile"
fi