ASUSTOR Snapshot (Time Machine) Backup
Posted: Sat Apr 30, 2016 12:33 pm
Hi, there are many tools for snapshot backup style. where you can get a backup of every day where only changes take additional space. You will have for example folder 22-APR-2016, 23-APR-2016 and every one of them will have the complete file tree. If a file is changed in 22 April you will find different version in 23 April backup. the 22 April version will be kept.
The Backup Script:
https://github.com/damascene/backup-scr ... -backup.sh (use this link to get the latest version).
I've tested it on ASUSTOR 202-TE, I'm using it with public key authentication to login to a windows machine remotely. My setup on Windows server is: Windows + Cygwin + Openssh + Rsync. If you are interested in Windows backup setup details you can ask me.
Hopefully some day Rsnapshot package will be available. it's more advanced perl script. I've opened a feature request for it here:
Add Rsnapshot package http://forum.asustor.com/viewtopic.php?f=23&t=7778
The Script: Version: 0.1.3
Hope it will be useful to you, test it before running it on your important files.
The Backup Script:
https://github.com/damascene/backup-scr ... -backup.sh (use this link to get the latest version).
I've tested it on ASUSTOR 202-TE, I'm using it with public key authentication to login to a windows machine remotely. My setup on Windows server is: Windows + Cygwin + Openssh + Rsync. If you are interested in Windows backup setup details you can ask me.
Hopefully some day Rsnapshot package will be available. it's more advanced perl script. I've opened a feature request for it here:
Add Rsnapshot package http://forum.asustor.com/viewtopic.php?f=23&t=7778
The Script: Version: 0.1.3
Code: Select all
#!/bin/sh
#### Based on Rsync Date Stamped, Snapshot Style, Incremental Backups http://webgnuru.com/linux/rsync_incremental.php ########
## This version is modifed to work on BusyBox Sh shell
## Date command is different in BusyBox from the Bash vrsion
# Copyright 2016 Usama Akkad, Released under GNU General Public License v3.
# BusyBox Snapshot Backup Script is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#Software version 0.1.3
#WARNING - TEST BEFORE YOU USE. A MISTAKE IN RSYNC COULD ERASE YOUR FILES. USE WITH CAUTION.
#Website Backup Script
#Todays date in ISO-8601 format:
day0=$(date -I)
#Yesterdays date in ISO-8601 format that works in Bash:
#DAY1=`date -I -d "1 day ago"`
#Yesterdays date in ISO-8601 format that works in BusyBox:
day1=$(date -I -d @$(( $(date +%s) - (24*60*60) )))
#The source directory:
source="/path/to/source/files/"
#The target directory:
target="/path/to/backup/location/$day0"
#The remote server informaions:
remote="test@example.org"
#The link destination directory:
link="/path/to/backup/location/$day1"
#Rsync options:
#OPT="-avh -e ssh --delete --link-dest=$LNK"
#Execute the backup
#Remove --dry-run to activate the command. With --dry-run it will just demonistrate what will happen.
rsync -avh -e ssh --dry-run --delete --link-dest="$link" "$remote:$source" "$target"
##optional delete old files
##29 days ago in ISO-8601 bash format
##
##DAY29=`date -I -d "29 days ago"`
##29 days ago in ISO-8601 busybox sh format
#day29=`date -I -d @$(( $(date +%s) - (29*24*60*60) ))`
#Delete the backup from 29 days ago, if it exists
#if [ -d /path/to/backup/location/$day29 ]
#then
#rm /path/to/backup/location/$day29
#fi