From 37bd5fec9954e5c991bd39636028daf5af00012d Mon Sep 17 00:00:00 2001 From: Tai Lee Date: Thu, 12 Dec 2024 10:22:30 +1100 Subject: [PATCH] Add support for `RESTIC_KEEP_YEARLY` env var, with a default of 7. --- README.md | 1 + bin/prune.sh | 3 ++- docker-compose.yml | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2458913..0690e5b 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ You can also pass the following environment variables to override the defaults: -e RESTIC_KEEP_DAILY='7' -e RESTIC_KEEP_WEEKLY='4' -e RESTIC_KEEP_MONTHLY='12' + -e RESTIC_KEEP_YEARLY='7' You can backup 5 different database clusters with `PG*_[1..5]`, and assign an arbitrary hostname with `HOSTNAME_[1..5]` (if `PGHOST` is not a fully qualified domain name) environment variables. diff --git a/bin/prune.sh b/bin/prune.sh index 5f451c6..1bafd47 100755 --- a/bin/prune.sh +++ b/bin/prune.sh @@ -10,7 +10,8 @@ while ! restic forget \ --keep-hourly="${RESTIC_KEEP_HOURLY:-24}" \ --keep-daily="${RESTIC_KEEP_DAILY:-7}" \ --keep-weekly="${RESTIC_KEEP_WEEKLY:-4}" \ - --keep-monthly="${RESTIC_KEEP_MONTHLY:-12}"; do + --keep-monthly="${RESTIC_KEEP_MONTHLY:-12}" \ + --keep-yearly="${RESTIC_KEEP_YEARLY:-7}"; do echo "Sleeping for 10 seconds before retry..." sleep 10 done diff --git a/docker-compose.yml b/docker-compose.yml index 9f20b6c..7b496dc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,6 +16,7 @@ services: # RESTIC_KEEP_DAILY: 7 # RESTIC_KEEP_WEEKLY: 4 # RESTIC_KEEP_MONTHLY: 12 + # RESTIC_KEEP_YEARLY: 7 RESTIC_PASSWORD: RESTIC_REPOSITORY: image: interaction/restic-pg-dump