From d3732519b9749fe2cb338818f8cf16533f5e5424 Mon Sep 17 00:00:00 2001 From: Tobias Kaupat Date: Tue, 8 Nov 2016 00:32:13 +0100 Subject: [PATCH] Support RESTIC_FORGET_ARGS --- Dockerfile | 1 + backup.sh | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6f211de..ec7e19c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,7 @@ ENV RESTIC_TAG="" ENV NFS_TARGET="" # By default backup every 6 hours ENV BACKUP_CRON="* */6 * * *" +ENV RESTIC_FORGET_ARGS="" # /data is the dir where you have to put the data to be backed up VOLUME /data diff --git a/backup.sh b/backup.sh index 3e0954d..3efa25b 100644 --- a/backup.sh +++ b/backup.sh @@ -4,4 +4,7 @@ echo "Starting Backup" restic backup /data --tag=${RESTIC_TAG?"Missing environment variable RESTIC_TAG"} >> /var/log/cron.log - +if [ -n "${RESTIC_FORGET_ARGS}" ]; then + echo "Forget about old snapshots based on RESTIC_FORGET_ARGS = ${RESTIC_FORGET_ARGS}" + restic forget ${RESTIC_FORGET_ARGS} +fi