mirror of
https://github.com/thegeeklab/retry.git
synced 2024-11-21 23:20:40 +00:00
update readme for shell version, add env parameter example
This commit is contained in:
parent
39ef2201bb
commit
7dfebe7751
33
README.md
33
README.md
@ -1,4 +1,4 @@
|
||||
retryit - The command line retry tool
|
||||
retry - The command line retry tool
|
||||
------------------------------------------
|
||||
|
||||
Retry any shell command with exponential backoff or constant delay.
|
||||
@ -7,7 +7,13 @@ Retry any shell command with exponential backoff or constant delay.
|
||||
|
||||
Install:
|
||||
|
||||
`gem install retryit`
|
||||
retry is a shell script, so drop it somewhere and make sure it's added to your $PATH. Or you can use the following one-liner:
|
||||
|
||||
`sudo sh -c "curl https://raw.githubusercontent.com/kadwanev/retry/master/retry -o /usr/local/bin/retry && chmod +x /usr/local/bin/retry"`
|
||||
|
||||
If you're on OS X, spark is also on Homebrew:
|
||||
|
||||
`brew install retry`
|
||||
|
||||
### Usage
|
||||
|
||||
@ -15,13 +21,14 @@ Help:
|
||||
|
||||
`retry -?`
|
||||
|
||||
Usage: retry [options] [-f fail_script +commands] -e execute command
|
||||
Usage: retry [options] -- execute command
|
||||
-h, -?, --help
|
||||
-f Execute fail script after all retries are exhausted
|
||||
-v, --verbose Verbose output
|
||||
-t, --tries=# Set max retries: Default 10
|
||||
-s, --sleep=secs Constant sleep amount (seconds)
|
||||
-m, --min=secs Exponenetial Backoff: minimum sleep amount (seconds): Default 0.3
|
||||
-x, --max=secs Exponenetial Backoff: maximum sleep amount (seconds): Default 60
|
||||
-f, --fail="script +cmds" Fail Script: run in case of final failure
|
||||
|
||||
### Examples
|
||||
|
||||
@ -60,7 +67,7 @@ Test functionality:
|
||||
|
||||
Limit retries:
|
||||
|
||||
`retry -t 4 -e 'echo "y u no work"; false'`
|
||||
`retry -t 4 'echo "y u no work"; false'`
|
||||
|
||||
y u no work
|
||||
Before retry #1: sleeping 0.3 seconds
|
||||
@ -77,11 +84,11 @@ Bad command:
|
||||
|
||||
`retry poop`
|
||||
|
||||
Command Failed: poop
|
||||
bash: poop: command not found
|
||||
|
||||
Fail command:
|
||||
|
||||
`retry -t 3 -f echo "oh poopsickles" -e 'echo "y u no work"; false'`
|
||||
`retry -t 3 -f 'echo "oh poopsickles"' 'echo "y u no work"; false'`
|
||||
|
||||
y u no work
|
||||
Before retry #1: sleeping 0.3 seconds
|
||||
@ -93,6 +100,18 @@ Fail command:
|
||||
Retries exhausted, running fail script
|
||||
oh poopsickles
|
||||
|
||||
Last attempt passed:
|
||||
|
||||
`retry -t 3 -- 'if [ $RETRY_ATTEMPT -eq 3 ]; then echo Passed at attempt $RETRY_ATTEMPT; true; else echo Failed at attempt $RETRY_ATTEMPT; false; fi;'`
|
||||
|
||||
Failed at attempt 0
|
||||
Before retry #1: sleeping 0.3 seconds
|
||||
Failed at attempt 1
|
||||
Before retry #2: sleeping 0.6 seconds
|
||||
Failed at attempt 2
|
||||
Before retry #3: sleeping 1.2 seconds
|
||||
Passed at attempt 3
|
||||
|
||||
### License
|
||||
|
||||
Apache 2.0 - go nuts
|
||||
|
Loading…
Reference in New Issue
Block a user