summaryrefslogtreecommitdiff
path: root/scripts/utils.sh
blob: 6faa701f0ce1c10562a6d6d1a8776b1166a1a37f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
retry() {
    if eval "$@"; then
        return 0
    fi

    for i in 2 1; do
        sleep 3s
        echo "Retrying $i..."
        if eval "$@"; then
            return 0
        fi
    done
    return 1
}