Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions scripts/opt/backup-loop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -431,15 +431,21 @@ restic() {
}

_unlock() {
if ! [ -z "${output=$(command restic list locks 2>&1)}" ];then
log WARN "Confirmed stale lock on repo, unlocking..."
if [[ unlock=$(command restic unlock 2>&1) == *"success"* ]]; then
if output="$(command restic list locks 2>&1)" && [ -n "${output}" ]; then
log WARN "Confirmed stale lock on repo, unlocking..."
if unlock_output="$(command restic unlock 2>&1)"; then
if [ -n "${unlock_output}" ]; then
<<<"${unlock_output}" log INFO
fi
log INFO "Successfully unlocked the repo"
else
else
if [ -n "${unlock_output}" ]; then
<<<"${unlock_output}" log ERROR
fi
log ERROR "Unable to unlock the repo. Is there another process running?"
return 1
fi
fi
fi
fi
}

_check() {
Expand Down