restic init option to ignore if already exists
Dear restic,
thank you for creating the useful tool.
During writing of a backup script I was unable to find an option to suppress the error message: "Fatal: create key in repository at ... failed: repository master key and config already initialized"
Some inspiration from kubernetes:
restic init --ignore-if-exists
or helm:
restic backup --init
priority: low version: restic 0.13.0 compiled with go1.18 on darwin/amd64
What is your use case exactly? Would a command to check whether a repository already exist be more useful for your use case?
Not OP, but such a command, to check this natively, would indeed be helpful. F.e. currently our detection if a repo was initialized, looks like this:
if ! run_restic snapshots &>/dev/null; then log something if ! run_restic init; then log something exit 2 fi fi
Works great, but is more of a workaround.
ah thanks, I am lazy and just do restic init || true
@iheartski run_restic cat config would probably be a lot faster to check whether a repository exists.
In my non scientific test, i see practically no difference in speed between cat config and snapshots. Checked for a repo with 7 snapshots, and one with 1300+. Runtimes are within .1 seconds usually. No WAN connection involved, SFTP storage backend.