Skip to content

Instantly share code, notes, and snippets.

@landsman
Created September 22, 2017 12:50
Show Gist options
  • Save landsman/922c4148da1c5b5d90433d0178965434 to your computer and use it in GitHub Desktop.
Save landsman/922c4148da1c5b5d90433d0178965434 to your computer and use it in GitHub Desktop.
rsync example - you can sync one big file / folder from server to server
#!/usr/bin/env bash
# you must be logged on SSH of first server
PORT='22077'
WHAT='the_big_file_or_folder_with_absolute_path.sql'
SRVR='[email protected]'
DEST='/home/hf/stage.marianne.cz/builds/91/docroot/'
color_output() {
echo -e "\033[$2m$1\033[0m"
}
title_label() {
color_output "$1" "$START_END_SCRIPT_COLOR"
}
START_END_SCRIPT_COLOR=37
START_TASK_COLOR=33
END_TASK_COLOR=36
title_label "$(date) - started rsync"
# let's go !!!
rsync -avSH -e "ssh -p ${PORT}" ${WHAT} ${TO}:${DEST} --verbose --progress --numeric-ids
title_label "$(date) - FINISHED rsync"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment