Restic unlock should tell if a relevant lock has been removed


It would be nice if restic unlock tell me, if there WAS a relevant lock.
Currently it is always telling me, that the lock has been removed…

What do you think?

Could always do restic list locks && restic unlock?

1 Like

restic list locks
shows a file/object if locked. Ok.

But if there is NO (stale) lock
restic unlock
tells me that a lock has just been removed successfully…
That is confusing my scripts to manage backups on our systems. So I cannot rely on that response.

Is there a way to set the lock status explicitly?

Only way I’ve found is by copying the lock file out while doing a prune job. Then you can copy it back in any time you want to manually lock the repository, and remove it to unlock it. Not ideal, but it works and is scriptable.

What actual problem are you trying to solve by wanting to be able to determine if any locks were actually removed or not, rather than just needing to know that there are no longer any locks around?

System A has started a backup job.

System B wants to do a clean/forget/prune/(repo-changing) job etc. on the same S3-Repo at overlapping time.

Assuming the A job diet/fails or simply runs.
I want to know if a restic unlock by System B reliably solved the problem or not, or System B simply has to wait.
Thats all. I cannot see, what system has set the lock file, right? How to decrypt the lock file?

You can use restic list locks followed by restic cat lock $lock_id.

Thanks a lot. That works.