Created
September 13, 2013 17:12
-
-
Save jk0/6553389 to your computer and use it in GitHub Desktop.
Rsync Backup Script
This file contains hidden or 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
| #!/bin/bash | |
| DRY_RUN=false | |
| REMOTE_HOST="<HOST>" | |
| REMOTE_PATH="<ABSOLUTE PATH>" | |
| LOCAL_PATH="<ABSOLUTE PATH>" | |
| RSYNC_OPTIONS=( | |
| -a # archive mode | |
| -g # preserve group | |
| -l # copy symlinks as symlinks | |
| -m # prune empty directory chains from file-list | |
| -o # preserve owner | |
| -p # preserve permissions | |
| -r # recurse into directories | |
| -t # preserve modification times | |
| -v # increase verbosity | |
| -z # compress file data during the transfer | |
| --safe-links # ignore symlinks that point outside the tree | |
| ) | |
| if $DRY_RUN ; then | |
| RSYNC_OPTIONS+=" -n" | |
| fi | |
| rsync ${RSYNC_OPTIONS[@]} -e ssh ${REMOTE_HOST}:${REMOTE_PATH} ${LOCAL_PATH} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment