From: gregrwm <bac...@wh...> - 2013-03-03 01:18:54
|
> > > i'm using a simple procedure i cooked up to maintain a "third copy" at a > > third physical location using as little bandwidth as possible. it simply > > looks at each pc/*/backups, selects the most recent full and most recent > > incremental (plus any partial or /new), and copies them across the wire, > > together with the most recently copied full&incremental set > > [...] > > that's already there (and not bothering with the cpool), which, for me, > is > > a happily sized set of hardlinks that rsync can actually manage (ymmv). > > [...] if it's of interest i could share it. > > I think this fills a useful use case, so yeah I would say send it to > the mailing list. > #currently running as "pull", tho can run as "push" with minor mods: #(root bash) rbh=remote.backuppc.host b=/var/lib/BackupPC/pc cd /local/third/copy sb='sudo -ubackuppc' ssp="$sb ssh -p2222" #nonstandard ssh port ssb="$ssp $rbh cd $b" from_to=("$rbh:$b/*" .) fob=$ssb df=($(df -m .)) prun= #prun=--delete-excluded to prune local/third/copy down to most recent backups only echo df=${df[10]} prun=$prun #show current filespace and prun setting [ ! -s iMRFIN ]&&{ touch iMRFIN ||exit $?;} #most recent finished set [ ! -s iMRUNF ]&&{ touch iLRUNF ||exit $?;}||{ cat iMRUNF>>iLRUNF||exit $?;} #most recent and less recent unfinished sets $fob 'echo " --include=*/new" #any unfinished backups for m in */backups;do unset f i #look at all pc/*/backups files while read -r r;do r=($r) [[ ${r[1]} = full ]]&&fu[f++]=$r [[ ${r[1]} = incr ]]&&in[i++]=$r [[ ${r[1]} = partial ]]&&echo " --include=${m%backups}$r" #any incomplete backups done < $m [[ $f -gt 0 ]]&&echo " --include=${m%backups}${fu[f-1]}" #most recent full [[ $i -gt 0 ]]&&echo " --include=${m%backups}${in[i-1]}" #most recent incremental done'>| iMRUNF ||echo badexit;head -99 i* #show backup sets included for transfer rc=255;while [[ $rc = 255 ]];do date #reconnect if 255(connection dropped) #note some special custom excludes are on a separate line rsync -qPHSae"$ssp" --rsync-path="sudo rsync" $(cat iMRFIN iLRUNF iMRUNF) $prun --exclude="/*/*/" \ --exclude=fNAVupdate --exclude=fDownloads --exclude=\*Personal --exclude="*COPY of C*" \ "${from_to[@]}" rc=$?;echo rc=$rc;if [ $rc = 0 ];then mv iMRUNF iMRFIN;rm iLRUNF;fi;done;df -m . |