From 6a55359d2899096e6ffed1d26b57a7e901e15578 Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Sat, 10 Oct 2020 10:54:25 -0500 Subject: [PATCH] Fix inaccurate counter in restic-job script --- roles/restic/files/restic-job.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/roles/restic/files/restic-job.sh b/roles/restic/files/restic-job.sh index 7fa6d15..fd82011 100755 --- a/roles/restic/files/restic-job.sh +++ b/roles/restic/files/restic-job.sh @@ -111,10 +111,12 @@ until [ $counter -eq "$MAX_ATTEMPTS" ] || [ $rc -eq 0 ]; do rc=$? - if [ $rc -ne 0 ]; then - sleep=$((counter * 5)) - printf "sleeping for %d seconds (%d)\n" $sleep $counter - sleep $sleep + if [ $rc -eq 0 ]; then + break + else + sleep=$((counter * 5)) + printf "sleeping for %d seconds (%d)\n" $sleep $counter + sleep $sleep fi (( counter++ ))