Skip to content

Instantly share code, notes, and snippets.

@jsidhu
Created March 24, 2017 06:20
Show Gist options
  • Save jsidhu/90e4f30cff0d0f1bc8c69add08826e97 to your computer and use it in GitHub Desktop.
Save jsidhu/90e4f30cff0d0f1bc8c69add08826e97 to your computer and use it in GitHub Desktop.
simple shell script to retry ssh repeatedly till connection succeeds.
while true; do
ssh -o ConnectTimeout=1 -o ConnectionAttempts=1 $@;
RESULT=$?
if [ "${RESULT}" -eq 0 ]; then
break
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment