Skip to content

Instantly share code, notes, and snippets.

@jk0
Created July 23, 2015 19:11
Show Gist options
  • Select an option

  • Save jk0/646b110687749e91cdda to your computer and use it in GitHub Desktop.

Select an option

Save jk0/646b110687749e91cdda to your computer and use it in GitHub Desktop.
Weechat Backup
jkearney@irc:~/bin$ cat backup_weechat.sh
#!/bin/bash
DRY_RUN=false
REMOTE_HOST="localhost"
REMOTE_PORT="2222"
REMOTE_USER="root"
REMOTE_PATH="/volume1/Backup/Weechat"
LOCAL_PATH="/home/jkearney/.weechat/*"
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 -p ${REMOTE_PORT}" ${LOCAL_PATH} ${REMOTE_USER}@${REMOTE_HOST}:${REMOTE_PATH}
jkearney@irc:~/bin$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment