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

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.

1 Like

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".

1 Like

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

1 Like

Hmm maybe even a “/f” flag like “chkdsk /f” so that it doesn’t just report the error, but it goes ahead and does what it needs to in order to fix it?