Skip to content

Commit 20997c7

Browse files
committed
move installed dependency check. update doc
1 parent 9136010 commit 20997c7

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ Help:
3535
-x, --max=secs Exponential Backoff: maximum sleep amount (seconds): Default 60
3636
-f, --fail="script +cmds" Fail Script: run in case of final failure
3737

38+
#### State
39+
40+
Environment variable `RETRY_ATTEMPT` is set with the current attempt number.
41+
3842
### Examples
3943

4044
No problem:

retry

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ __sleep_amount() {
77
if [ -n "$constant_sleep" ]; then
88
sleep_time=$constant_sleep
99
else
10-
if ! command -v awk &> /dev/null; then
11-
__log_out "Error: awk not found, please install awk."
12-
exit 1
13-
fi
1410
#TODO: check if user would rather use one of the other possible dependencies: python, ruby, bc, dc
1511
sleep_time=`awk "BEGIN {t = $min_sleep * $(( (1<<($attempts -1)) )); print (t > $max_sleep ? $max_sleep : t)}"`
1612
fi
@@ -104,6 +100,10 @@ EOF
104100
echo "I’m sorry, 'getopt --test' failed in this environment. Please load GNU getopt."
105101
exit 1
106102
fi
103+
if ! command -v awk &> /dev/null; then
104+
__log_out "Error: awk not found, please install awk."
105+
exit 1
106+
fi
107107

108108
OPTIONS=vt:s:m:x:f:
109109
LONGOPTIONS=verbose,tries:,sleep:,min:,max:,fail:

0 commit comments

Comments
 (0)