Add fancy templating to Nextcloud backups

Because I, regrettably, do not have backups for the past like month because data got huge
This commit is contained in:
Salt 2020-09-22 17:14:16 -05:00
parent c054cbec87
commit 27d8b9f88b

View File

@ -44,8 +44,14 @@ fi
# WE MAKE BACKUP NOW SERGEI
if cd "{{ nextcloud_webroot }}"; then
date="$(date -Iseconds)"
{% if aws.backup_bucket is defined %}
# We have an AWS bucket to back straight up to
log "Piping data backup straight to S3"
tar czh "/var/nextcloud" --exclude "/var/nextcloud/*/files_trashbin" | aws s3 cp - "s3://{{ aws.backup_bucket }}/{{ nextcloud.url }}/{{ nextcloud.url }}-$date-data.tar.gz" --storage-class STANDARD
{% else %}
log "Creating data backup"
tar czhf "$OUTDIR/{{ nextcloud.url }}-$date-data.tar.gz" "/var/nextcloud" --exclude "/var/nextcloud/*/files_trashbin"
{% endif %}
log "Creating webroot backup"
tar czf "$OUTDIR/{{ nextcloud.url }}-$date-webroot.tar.gz" "{{ nextcloud_webroot }}"
else