Fix notification stats bug with more than 2 latest snapshots

This commit is contained in:
Erik Westrup
2022-04-29 20:11:49 +02:00
parent d5497b04b4
commit f17848bed2
2 changed files with 5 additions and 0 deletions

View File

@@ -115,6 +115,7 @@ if [ "$RESTIC_NOTIFY_BACKUP_STATS" = true ]; then
latest_snapshot_diff=$(restic snapshots --tag "$RESTIC_BACKUP_TAG" --latest 2 --compact \
| grep -Ei "^[abcdef0-9]{8} " \
| awk '{print $1}' \
| tail -2 \
| tr '\n' ' ' \
| xargs restic diff)
added=$(echo "$latest_snapshot_diff" | grep -i 'added:' | awk '{print $2 " " $3}')