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