Skip to content

Commit

Permalink
Merge branch 'fix/exit-status-3' into 'main'
Browse files Browse the repository at this point in the history
fix/exit status 3

See merge request proteus-projects/IT/ansible-role-restic_client!25
  • Loading branch information
Florian Schwär committed Sep 11, 2024
2 parents 556887b + 1b5d1c4 commit 8c2f0a3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion templates/restic-backup.service.j2
Original file line number Diff line number Diff line change
@@ -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]
Expand All @@ -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

0 comments on commit 8c2f0a3

Please sign in to comment.