bundlewrap/bundles/backup-client/files/generate-backup-with-retries
Franziska Kunsmann 14e4415e5f
All checks were successful
kunsi/bundlewrap/pipeline/head This commit looks good
bundles/backup-client: rework backup generation
2022-01-07 08:29:34 +01:00

22 lines
478 B
Bash

#!/bin/bash
# Try generating a backup multiple times. If one attempt succeeds, we're
# done. If not, there will be logs for every attempt, plus monitoring
# will read the result of the last backup.
for try in {1..3}
do
generate-backup "$try"
exitcode=$?
if [[ $exitcode -eq 100 ]]
then
# fatal error, cannot recover
exit 1
elif [[ $exitcode -eq 0 ]]
then
# successful backup
exit 0
else
sleep 60
fi
done