I’m running these steps daily:
restic backup (with my parameters)
restic forget --keep-daily 1 --keep-last 30 --prune
So, your main question is probably, why do you unlock? Well, the prune was complaining that the repository was locked after the backup finished (not always). Is the backup process not finished when the backup command is done? If that is the case, and force unlocking destroys the prune process, there isn’t really a way to automate backup and directly prune afterwards.
since there are snapshots qualifying for prune I get errors:
processed 27414 files, 881.833 MiB in 1:17 snapshot dced3a81 saved Backup Successful! Unlocking backend as extra check Unlocking backend successfully removed locks Starting cleanup of old backups Applying Policy: keep the last 30 snapshots, 1 daily snapshots 1 snapshots have been removed, running prune counting files in repo building new index for repo [0:10] 100.00% 230 / 230 packs repository contains 230 packs (25881 blobs) with 804.155 MiB processed 25881 blobs: 0 duplicate blobs, 0B duplicate load all snapshots find data that is still in use for 30 snapshots tree 589981bde504257259c789b65e08d72a3927c68f0dc08d01fab6835bed35f3b4 not found in repository
There are lines omitted above and some were added by my script.
I can fix this by running
check --read-data and running the prune command afterwards. However, the cause of the problem still remains. Not sure if unlocking is the cause though. This ran on version 0.9.0-20