From 864fa883c9973f4512e4db6e32e22070a1e6de1b Mon Sep 17 00:00:00 2001 From: Elias Backmund Date: Wed, 11 Sep 2024 09:32:31 +0200 Subject: [PATCH 1/2] Add back comment --- templates/restic-backup.service.j2 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/restic-backup.service.j2 b/templates/restic-backup.service.j2 index ded56a6..b0577f6 100644 --- a/templates/restic-backup.service.j2 +++ b/templates/restic-backup.service.j2 @@ -1,4 +1,4 @@ -{# barefaced stolen from https://fedoramagazine.org/automate-backups-with-restic-and-systemd/ #} +{# initially stolen from https://fedoramagazine.org/automate-backups-with-restic-and-systemd/ #} # {{ ansible_managed }} [Unit] @@ -20,6 +20,8 @@ ExecStart={{ restic_client_bin_dir }}/restic backup \ {# Do not start a backup run (ExecStart) when doing a systemd service reload. Instead, run this arbitrary command which also proves the repo is working as expected. #} ExecReload={{ restic_client_bin_dir }}/restic version +{# Exit 3: backup command could not read some source data + https://restic.readthedocs.io/en/stable/075_scripting.html#exit-codes #} SuccessExitStatus=3 EnvironmentFile={{ restic_client_config_dir }}/backup.conf SyslogIdentifier=restic From 1b5d1c4c8bcf7395c104f713d6bde39af5ac42b0 Mon Sep 17 00:00:00 2001 From: Elias Backmund Date: Wed, 11 Sep 2024 09:33:14 +0200 Subject: [PATCH 2/2] Adapt known limitations since the service will not fail on exit 3 anymore --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 98de73b..4ec8724 100644 --- a/README.md +++ b/README.md @@ -91,10 +91,10 @@ On some directories - e.g. `gvfs` mounts on Ubuntu - `restic` cannot read the me restic[673470]: scan: lstat /home/user/.cache/gvfs: permission denied restic[673470]: error: lstat /home/user/.cache/gvfs: permission denied ``` -This will mark the systemd service as `failed`, although the backup will finish correctly. Add affected directories to `restic_client_custom_excludes` list. +The systemd service will exit successfully and ignore those errors (see [Scripting - restic documentation](https://restic.readthedocs.io/en/stable/075_scripting.html)). Add affected directories to `restic_client_custom_excludes` list to skip them. ### File disappeared -Occationally, files will disappear after restic scanned them but did not backup them yet. Backups will finish successfully, but the `restic-backup.service` will be marked as `failed`. To remedy, either **a**) rerun the `restic-backup.service`, **b**) reset the service state by running `systemctl reset-failed restic-backup.service`, or **c**) ignore and wait for next backup. +Occationally, files will disappear after restic scanned them but did not backup them yet. Backups will finish successfully, and the `restic-backup.service` will print them out. ## Backup consistency If LVM is not used on a node, there is no mechanism in place to ensure consistency for backups, so a backup might include files from two distinct application states.