Last active
December 22, 2015 14:18
-
-
Save typomedia/6484306 to your computer and use it in GitHub Desktop.
Rsync Remote Backup Script
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
#!/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 |
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
# /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