Skip to content

Instantly share code, notes, and snippets.

@lanrat
Created April 2, 2014 21:58
Show Gist options
  • Save lanrat/9944079 to your computer and use it in GitHub Desktop.
Save lanrat/9944079 to your computer and use it in GitHub Desktop.
ssh proxy rsync
REMOTE_USER=usename
REMOTE_HOST=source.com
REMOTE_PORT=22
REMOTE_DIR=folder
LOCAL_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROXY_ENABLE=true
PROXY_USER=proxy-user
PROXY_HOST=proxy.host.com
PROXY_PORT=22
if [ "$PROXY_ENABLE" = true ]
then
CMD="rsync -rzhP -e 'ssh -o \"Proxycommand ssh -p $PROXY_PORT $PROXY_USER@$PROXY_HOST -W %h:%p\" -p $REMOTE_PORT' $REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/ $LOCAL_DIR"
else
CMD="rsync -rzhP -e 'ssh -p $REMOTE_PORT' $REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/ $LOCAL_DIR"
fi
#echo $CMD
eval $CMD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment