Rsync Daily Snapshots

Apr 17, 2006

Need to backup in a hurry? Want to create daily snapshots that don’t take more drive platters than Google? Here’s a quick and efficient way to back-up data from your RSYNC server. Warning do not try this on the interweb kids, only on a trusted link (ie/ not the wild west that is the inter-web).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh

HOST=localhost.localdomain
BASE=/home/samba/rsync
DATEDIR=`date +%Y-%m-%d-%a`
CUR=current
BAK="HOME ETC VAR"

for CURVOL in $BAK; do
rsync -avz --delete --force rsync://$HOST/$CURVOL $BASE/$CUR/$CURVOL
done

mkdir $BASE/$DATEDIR
cp -Rl $BASE/$CUR/* $BASE/$DATEDIR/

tags: [ rsync ]