mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
25 lines
391 B
Plaintext
25 lines
391 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
function run_with_retry()
|
||
|
{
|
||
|
set +e
|
||
|
|
||
|
local total_retries="$1"
|
||
|
shift
|
||
|
|
||
|
local retry=0
|
||
|
|
||
|
until [ "$retry" -ge "$total_retries" ]
|
||
|
do
|
||
|
if "$@"; then
|
||
|
set -e
|
||
|
return
|
||
|
else
|
||
|
retry=$((retry + 1))
|
||
|
sleep 5
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
echo "Command '$*' failed after $total_retries retries, exiting"
|
||
|
exit 1
|
||
|
}
|