Skip to content

Commit

Permalink
Fix "borgmatic list --successful" with a slightly better heuristic fo…
Browse files Browse the repository at this point in the history
…r listing successful (non-checkpoint) archives.
  • Loading branch information
witten committed Oct 16, 2019
1 parent d6aaab8 commit c12c47c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1.3.26
* #224: Fix "borgmatic list --successful" with a slightly better heuristic for listing successful
(non-checkpoint) archives.

1.3.25
* #223: Dead man's switch to detect when backups start failing silently, implemented via
healthchecks.io hook integration. See the documentation for more information:
Expand Down
5 changes: 3 additions & 2 deletions borgmatic/borg/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
logger = logging.getLogger(__name__)


# A hack to convince Borg to exclude archives ending in ".checkpoint".
BORG_EXCLUDE_CHECKPOINTS_GLOB = '*[!.][!c][!h][!e][!c][!k][!p][!o][!i][!n][!t]'
# A hack to convince Borg to exclude archives ending in ".checkpoint". This assumes that a
# non-checkpoint archive name ends in a digit (e.g. from a timestamp).
BORG_EXCLUDE_CHECKPOINTS_GLOB = '*[0123456789]'


def list_archives(repository, storage_config, list_arguments, local_path='borg', remote_path=None):
Expand Down
12 changes: 9 additions & 3 deletions docs/how-to/monitor-your-backups.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,15 @@ output only shows up at the console, and not in syslog.
### Successful backups

`borgmatic list` includes support for a `--successful` flag that only lists
successful (non-checkpoint) backups. Combined with a built-in Borg flag like
`--last`, you can list the last successful backup for use in your monitoring
scripts. Here's an example combined with `--json`:
successful (non-checkpoint) backups. This flag works via a basic heuristic: It
assumes that non-checkpoint archive names end with a digit (e.g. from a
timestamp), while checkpoint archive names do not. This means that if you're
using custom archive names that do not end in a digit, the `--successful` flag
will not work as expected.

Combined with a built-in Borg flag like `--last`, you can list the last
successful backup for use in your monitoring scripts. Here's an example
combined with `--json`:

```bash
borgmatic list --successful --last 1 --json
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import find_packages, setup

VERSION = '1.3.25'
VERSION = '1.3.26'


setup(
Expand Down

0 comments on commit c12c47c

Please sign in to comment.