Skip to content

Instantly share code, notes, and snippets.

@dillonstreator
Created March 28, 2022 15:28
Show Gist options
  • Save dillonstreator/d3b767e99abe818a236e7cd1f9e2c523 to your computer and use it in GitHub Desktop.
Save dillonstreator/d3b767e99abe818a236e7cd1f9e2c523 to your computer and use it in GitHub Desktop.
run command until successful with sleep
dountil() {
s=${SLEEP:-1}
until eval $*; do echo "failed.. retrying in $s sec" && sleep $s; done
}
@dillonstreator
Copy link
Author

SLEEP=.5 dountil "echo 'PING' | nc localhost 3310 | grep 'PONG'"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment