On Tue, 2003-11-18 at 13:21, Bipinchandra Ranpura wrote:> Hello,...
> I have taken script from rsync examples, and made
> changes. . But it doesn`t work can someone help me.
...
Here is my script. It copies $1 to $2/date/ and deletes the mod(today,
$3) version from $3. The clean up scheme leaves me with some old, more
more recent copies.
It is fast. I mount windows machines vai smb and after the first
backup, can backup a whole 1.3GB machine in just a few minutes.
The results are similar to faubackup, without the reliance on inode
numbers. There is a directory for each day, but files are only copied
when changed and unchanged files are all hard links to the same file. I
think storeBackup works like this (just found it yesterday).
----
#!/bin/sh
src=$1
dest=`dirname "$2/dummy"`
count=$3
shift
shift
shift
last=`/bin/ls -d $dest/* | sort | tail -1`
last=`basename "$last"`
tmp="$dest/backup.$$.backup/"
now=`date +"%Y-%m-%d %H.%M.%S"`
rm -rf "$tmp"
/usr/local/bin/rsync -a $@ "--link-dest=../$last/" "$src"
"$tmp"
mv "$tmp" "$dest/$now"
# clean up
dir="$dest"
mod=$[ `date +"%d"` % $count]
while [ `/bin/ls "$dir" | wc -l` -gt $count ]
do
file=`/bin/ls "$dir" | awk 'NR=='$count'{print $0}'`
rm -rf "$dir/$file"
done