Skip to content

Instantly share code, notes, and snippets.

@cbrocas
Created September 28, 2014 14:43
Show Gist options
  • Save cbrocas/263f4b548891bf53d14d to your computer and use it in GitHub Desktop.
Save cbrocas/263f4b548891bf53d14d to your computer and use it in GitHub Desktop.
How to backup an external server on a synology Diskstation NAS
#!/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
@cbrocas
Copy link
Author

cbrocas commented Sep 28, 2014

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,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment