Find parent snapshot when doing backup

This commit is contained in:
2023-04-20 10:23:51 +02:00
parent 36ce00b576
commit 81ca46a94f

View File

@@ -34,7 +34,8 @@ echo "restic_unlock_duration $(echo "$(date +%s) - $ts" | bc)" >> /tmp/metrics
log_info "Running restic backup"
ts=$(date +%s)
restic backup --verbose --no-scan --tag "${TAG}" ${BACKUP_PATH}
# TODO: parent snapshot detection might fail so it's on our own, https://github.com/restic/restic/issues/2246
restic backup --verbose --no-scan --tag "${TAG}" --parent "$(restic snapshots --tag "${TAG}" -g paths,tags --path ${BACKUP_PATH} --json | jq -r ".[].snapshots | max_by(.time) | .short_id")" ${BACKUP_PATH}
echo "restic_backup_duration $(echo "$(date +%s) - $ts" | bc)" >> /tmp/metrics
log_info "Cleaning up old snapshots"
@@ -42,7 +43,6 @@ ts=$(date +%s)
restic forget --prune --tag "${TAG}" -g paths,tags ${KEEP_ARGS}
echo "restic_forget_duration $(echo "$(date +%s) - $ts" | bc)" >> /tmp/metrics
# Metrics
log_info "Collecting metrics"
ts=$(date +%s)