File: retry.sh

package info (click to toggle)
python-hypothesis 3.6.1-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,788 kB
  • sloc: python: 15,048; sh: 226; makefile: 160
file content (13 lines) | stat: -rwxr-xr-x 243 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env bash

for _ in $(seq 5); do
    if $@ ; then 
        exit 0
    fi
    echo "Command failed. Retrying..."
    sleep $[ ( $RANDOM % 10)  + 1 ].$[ ( $RANDOM % 100) ]s
done

echo "Command failed five times. Giving up now"

exit 1