remove stale locks

This commit is contained in:
tengel 2024-12-25 07:29:27 -06:00
parent 3878013afc
commit c432bffe76

View file

@ -90,13 +90,23 @@ function check_restic() {
# begin timestamp # begin timestamp
echo "== ${TIMESTAMP} ==" >> "${LOGFILE}" echo "== ${TIMESTAMP} ==" >> "${LOGFILE}"
# remove stale locks
restic -r "${REPO}" \
--password-file="${RKEY}" \
unlock >> "${LOGFILE}"
_EC=$?
# create a new snapshot # create a new snapshot
restic --quiet -r "${REPO}" \ if [[ $_EC -eq 0 ]]; then
restic --quiet -r "${REPO}" \
backup --no-scan \ backup --no-scan \
--password-file="${RKEY}" \ --password-file="${RKEY}" \
--exclude-file="${EXCL}" \ --exclude-file="${EXCL}" \
"${RSRC}" >> "${LOGFILE}" "${RSRC}" >> "${LOGFILE}"
_EC=$? _EC=$?
else
echo "Non-zero exit from restic unlock: $_EC" >> "${LOGFILE}"
fi
# prune older snapshots # prune older snapshots
if [[ $_EC -eq 0 ]]; then if [[ $_EC -eq 0 ]]; then