Created
September 28, 2014 14:43
-
-
Save cbrocas/263f4b548891bf53d14d to your computer and use it in GitHub Desktop.
How to backup an external server on a synology Diskstation NAS
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 | |
USER="uid" | |
SERVER="hostname" | |
PORT="22" | |
SSHID="/volume1/homes/admin/.ssh/id_rsa" | |
SOURCE1="/var/lib/automysqlbackup/" | |
TARGET1="/volume1/homes/admin/backups/hostname/automysqlbackup/" | |
SOURCE2="/var/cache/rsnapshot/" | |
TARGET2="/volume1/homes/admin/backups/hostname/rsnapshot/" | |
LOG="/volume1/homes/admin/backups/backup.log" | |
/usr/syno/bin/rsync -avz --delete --progress -e "ssh -p $PORT -i $SSHID" $USER@$SERVER:$SOURCE1 $TARGET1 > $LOG 2>&1 | |
/usr/syno/bin/rsync -avz --delete --progress -e "ssh -p $PORT -i $SSHID" $USER@$SERVER:$SOURCE2 $TARGET2 >> $LOG 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script syncs two folders to NAS :
. automysqlbackup that is a backup of MySQL DB on the server (blog + owncloud)
. rsnapshot one that is a backup of several directories (/etc, /www etc) on the source server,