resticprofile icon indicating copy to clipboard operation
resticprofile copied to clipboard

Run `check-before`/`check-after` only once per repository

Open lukasbestle opened this issue 1 year ago • 1 comments

My resticprofile configuration contains two profiles that use the same restic repository. The use case is to create separate snapshots of different directories so that one of the snapshots can be copied to another restic repository.

Both profiles use the check-after: true option. When I run resticprofile backup on each of the profiles, everything works as expected. But when I perform a backup on a group that contains both profiles, the checking is performed twice during the same run of resticprofile backup. As the entire repository is checked anyway, this is not necessary. Each subsequent check of the same repository in the same backup run should be skipped automatically.

lukasbestle avatar Feb 10 '24 15:02 lukasbestle

Hi,

Yes I see what you mean. This is something we can take into consideration when reviewing the version 2 of the configuration file format.

In the meantime it's easy to duplicate your profiles with inheritance, something like:

# configuration when running on its own
profile1:
  backup:
    source: /path1

# configuration when running on its own
profile2:
  backup:
    source: /path2

groups:
  backup_group:
    - profile1_in_group
    - profile2_in_group

# configuration when running as part of the group
profile1_in_group:
  inherit: profile1
  check-before: true
  check-after: false

# configuration when running as part of the group
profile2_in_group:
  inherit: profile2
  check-before: false
  check-after: true

This example configuration would do a check before and after the group, but you get the idea 👍🏻

creativeprojects avatar Feb 10 '24 17:02 creativeprojects