Deterministic output of `restic check` to know what to do next?


#1

Is there – or could we make – a way to know what kind of maintenance to perform after running restic check?

Preferably something programmable, like an exit code or some JSON output when run with the --json flag. Actually I think I’m leaning towards JSON output here.

For example, if I run restic check and it finds extra packs that can be pruned, it’d be nice to know in a JSON object something like this:

{"recommended_action": "prune", "reason": "extra packs found..."}

And similar for when restic rebuild-index should be run, etc.

Any thoughts on this? It’s not a formal proposal but I’m trying to automate repo maintenance and I think this would be helpful.


#2

Great idea! This could be printed on the terminal UI or via JSON or so :slight_smile:

Yes, I think it could be very helpful and should not be too hard to build. The check functions just need to keep track of what they find and then we could built a simple lookup table for it, like "if extra packs found, print run prune".


#3

Okay, cool. I’ll look into building this sometime after the current PRs are finished. :slight_smile: Thanks for your help!