Fix(restic) catch attempt failure

Failure was reported even when the last attempt was successful.
This commit is contained in:
Nicolas KAROLAK 2018-07-06 11:34:32 +02:00 committed by Jerome Charaoui
parent b09529e96b
commit ff61e65be4

View File

@ -71,12 +71,17 @@ function export_debug {
function run_cmd {
local pass=0
local cmd=$1
while [ $pass -lt $retry_run ]; do
(( pass++ ))
debug "Attempt $pass"
$1 && break
# return when cmd succeeded, pass when failed
$cmd && return 0 || :
sleep $retry_wait
done
# if we reach here, we have failed
return 1
}
### GLOBAL OPTIONS ############################################################