Skip to content
Repeat a command until the command succeeds.
C M4 Makefile
Branch: master
Clone or download
Latest commit 5007557 Jan 20, 2020
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
debian
.gitignore Add help2man to debian packaging build dependencies. Jan 15, 2020
AUTHORS Initial creation of the autotools. Jan 5, 2020
COPYING Initial creation of the autotools. Jan 5, 2020
ChangeLog Add help2man to debian packaging build dependencies. Jan 15, 2020
INSTALL Initial creation of the autotools. Jan 5, 2020
LICENSE
Makefile.am Add help2man to debian packaging build dependencies. Jan 15, 2020
NEWS Initial creation of the autotools. Jan 5, 2020
README Initial creation of the autotools. Jan 5, 2020
README.md Update README.md Jan 20, 2020
config.h.in Add libtool to autotools. Jan 13, 2020
configure.ac Run aclocal, bump version. Jan 15, 2020
retry.c
retry.spec.in Tab to space. Jan 13, 2020

README.md

retry

Retry a command until the command succeeds.

Retry captures stdin into memory as the data is passed to the repeated command, and this captured stdin is then replayed should the command be repeated. This makes it possible to embed the retry tool into shell pipelines.

Retry captures stdout into memory, and if the command was successful stdout is passed on to stdout as normal, while if the command was repeated stdout is passed to stderr instead. This ensures that output is passed to stdout once and once only.

downloads

The retry tool is available as RPMs through COPR as follows:

dnf copr enable minfrin/retry
dnf install retry

There is also a PPA for Ubuntu as follows:

sudo add-apt-repository ppa:minfrin/retry
sudo apt-get update
sudo apt-get install retry

example

~$ retry --until=success false
retry: 'false' returned 1, backing off for 10 seconds and trying again...
retry: 'false' returned 1, backing off for 10 seconds and trying again...
retry: 'false' returned 1, backing off for 10 seconds and trying again...
^C

more complex example

~$ retry curl --fail http://localhost/entities | \
  jq ... | \
  retry curl --fail -X POST http://localhost/resource | \
  logger -t resource-init
You can’t perform that action at this time.