mirror of
https://github.com/sbrl/bin.git
synced 2018-01-10 21:33:46 +00:00
25 lines
451 B
Text
25 lines
451 B
Text
|
#!/usr/bin/env bash
|
||
|
|
||
|
# Check we've got command line arguments
|
||
|
if [ -z "$*" ] ; then
|
||
|
echo "Need to specify ssh options"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
# Start trying and retrying
|
||
|
((count = 100))
|
||
|
while [[ $count -ne 0 ]] ; do
|
||
|
ssh $*
|
||
|
rc=$?
|
||
|
if [[ $rc -eq 0 ]] ; then
|
||
|
((count = 1))
|
||
|
fi
|
||
|
((count = count - 1))
|
||
|
done
|
||
|
|
||
|
# Print a message if we failed
|
||
|
if [[ $rc -ne 0 ]] ; then
|
||
|
echo "Could not connect to $* after 100 attempts - stopping."
|
||
|
fi
|
||
|
|