Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
chunk_stitching
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 54 lines (50 sloc) 1.29 KB
#!/bin/sh
connection_retries=30
connection_retrysleep=60
function retry_ssh {
n=0
while [[ 1 ]]; do
$sshcmd "$1" \
&& break || \
{
code="$?"
if [[ "$code" -eq 255 ]]; then
>&2 echo "Retrying ssh ..."
sleep $connection_retrysleep
else
>&2 echo "\"$1\" returned exit code $code."
return "$code"
fi
}
n=$[$n+1]
if [[ $n -ge $connection_retries ]]; then
>&2 echo "Cannot connect to server"
return 255
fi
done
return 0
}
function retry_rsync {
n=0
while [[ 1 ]]; do
rsync -e "$sshcmd" $@ \
&& break || \
{
code="$?"
code="$?"
if [[ "$code" -eq 255 ]]; then
>&2 echo "Retrying rsync ..."
sleep $connection_retrysleep
else
>&2 echo "\"$1\" returned exit code $code."
return "$code"
fi
}
n=$[$n+1]
if [[ "$n" -ge $connection_retries ]]; then
echo "Cannot connect to server"
exit 255
fi
done
return 0
}