Skip to content

Commit

Permalink
Merge pull request #1 from jan-brinkmann/development
Browse files Browse the repository at this point in the history
development
  • Loading branch information
jan-brinkmann authored Jan 8, 2022
2 parents 95f89ea + 0dd2e4c commit f7880be
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
# docker-rotate-backups
# docker-rotate-backups
This repository provides a Docker image that implements [`rotate-backups`](https://pypi.org/project/rotate-backups/).

By using this image, you are enabled to instantiate a container that runs rotate-backups once on a mounted directory. In the mounted directory, irrelevant backups are removed and useful are preserved. Afterwards, the container is stopped and, if desired, removed.

## How to use
Simply adapt the directory to mount and run the following command on your Docker host:
```
docker run --rm \
-v /path/to/backups:/archive \
ghcr.io/jan-brinkmann/docker-rotate-backups
```
The default scheme to preserve and to remove backups is `--daily=7 --weekly=4 --monthly=12 --yearly=always --dry-run`.

## How to customize
The scheme can be customized by means of `ROTATION_SCHEME`:
```
docker run --rm \
-e ROTATION_SCHEME="--daily=7 --weekly=4 --monthly=6" \
-v /path/to/backups:/archive \
ghcr.io/jan-brinkmann/docker-rotate-backups
```
For more information on the synthax and the options, we refer to the [official `rotate-backups` documentation](https://pypi.org/project/rotate-backups/#command-line).
6 changes: 3 additions & 3 deletions src/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

set -e

if [ -z $ROTATE_BACKUPS_CONFIG ]; then
ROTATE_BACKUPS_CONFIG="--daily=7 --weekly=4 --monthly=12 --yearly=always --dry-run"
if [ -z $ROTATION_SCHEME ]; then
ROTATION_SCHEME="--daily=7 --weekly=4 --monthly=12 --yearly=always --dry-run"
fi

/usr/local/bin/rotate-backups $ROTATE_BACKUPS_CONFIG /archive
/usr/local/bin/rotate-backups $ROTATION_SCHEME /archive

0 comments on commit f7880be

Please sign in to comment.