Created
April 2, 2014 21:58
-
-
Save lanrat/9944079 to your computer and use it in GitHub Desktop.
ssh proxy rsync
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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