Hi. Loving restic so far. I’m using it to backup a webserver directory to a business Google Drive. The backup script runs without issue every day. I have a prune script which runs once a week, which occasionally throws an error (locking) and fails to backup. The lock seems to be from the previous prune process (i.e. its dated approx 168 hours ago). I have a couple of questions about this.
The script logs the output of the prune process to a text file, and then emails it to me. The relevant line is:
/usr/bin/restic --repo rclone:mydrive:directory forget --prune --verbose --keep-daily 6 --keep-weekly 10 >> $LOGFILE
This works great when restic is behaving itself. However when it receives a lock error (or, I’m guessing, other errors), it doesn’t log this to the text file. There is NO output. It would be useful to have this information to see at a glance that something has gone wrong, and, optionally, also be able to use this information to make decisions in the script. eg. If lock detected with ‘check’ then run ‘unlock’, and send me an alert. How do I make the output of restic errors appear in my logfile?
I understand the correct way to fix the lock error is to run the restic ‘unlock’ command. First of all is there any downside to running it before I run each weekly prune? If there is no issue, then I might as well append it to the front of the script before pruning.
Or would it be better to run it at the end of the script, to ensure the locks are released at the end of the run?