Skip to content

Instantly share code, notes, and snippets.

@typomedia
Last active December 22, 2015 14:18
Show Gist options
  • Save typomedia/6484306 to your computer and use it in GitHub Desktop.
Save typomedia/6484306 to your computer and use it in GitHub Desktop.
Rsync Remote Backup Script
#!/bin/sh
# Copyright 2013 Typomedia Foundation. All rights reserved.
# Use is subject to license terms.
#
# Rsync Backup Script v1.3
EXEC=/usr/bin/rsync
SOURCEPATH=/mnt/dpool
DIRECTORIES=( media share works )
EXCLUDELIST=/etc/scripts/rsync.exclude.list
TARGETSERVER=192.168.1.2
TARGETUSER=rsync
TARGETPATH=/mnt/bpool
LOGFILE=/var/log/rsync.log
for DIR in ${DIRECTORIES[@]}
do
$EXEC --archive --inplace --compress \
--exclude-from=$EXCLUDELIST \
--log-file=$LOGFILE \
-e ssh $SOURCEPATH/$DIR $TARGETUSER@$TARGETSERVER:$TARGETPATH/$DIR
done
# /etc/scripts/rsync.exclude.list
# Copyright 2013 Typomedia Foundation. All rights reserved.
# Use is subject to license terms.
#
# Rsync Exclude List v1.0
#/boot
/cdrom
/dev
/lost+found
/media
/mnt
/proc
/run
/subvol
/sys
/tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment