lobaro / restic-backup-docker

A docker container to automate backups with restic
Apache License 2.0
330 stars 114 forks source link

restic snapshots exit code check #53

Open avgeeklucky opened 3 years ago

avgeeklucky commented 3 years ago

This has caused me problems:

https://github.com/lobaro/restic-backup-docker/blob/a07b831d783ce3d96d76201e9f98e849178f9748/entry.sh#L16-L31

Specifically, I've had backups be interrupted mid process (post backup cleanup or the backup it self, not sure) and they have locked the repository, causing restic snapshots to return a non 0 exit code, next the entry script tries to init a new repository which fails because it's already there. Because I've got restart=always, the container ends up in a restart loop.

I'm not sure how to fix this since restic does not provide meaningful exit codes (restic/restic#956). String parsing is not a great idea either...

bruno-lopes commented 3 years ago

I detected the same problem here. Perhaps it would be nice to use the following command

restic --no-lock list locks

This way it is possible to detect logs and provide a meaningful message to warn the user about the problem.

niondir commented 3 years ago

Sounds good. Feel free to provide a PR.

wuast94 commented 3 years ago

have the error too and all my backups cant start anymore :/