Here is what i use from crontab once a day:
it makes a space efficient copy of every file, and every version so i can retrieve any previous version, best to put the target snapshot directory on a different drive. adapted from: http://www.mikerubel.org/computers/rsync_snapshots/
#!/bin/sh
PATH=/usr/bin:/bin:$PATH
SNAPSHOTS=/home/hans/.snapshots
DIR=/home/hans/sheets
#-------------------------------------------
mtime()
#-------------------------------------------
{
echo "$1" | perl -e'
use strict;
my $line;
my $dev;
my $ino;
my $mode;
my $nlink;
my $uid;
my $gid;
my $rdev;
my $size;
my $atime;
my $mtime;
my $ctime;
my $blksize;
my $blocks;
my $sec;
my $min;
my $hour;
my $mday;
my $mon;
my $year;
my $wday;
my $yday;
my $mtime_string;
my @days = ("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
my @months = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec");
while ( $line = <STDIN> ) {
chomp($line);
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks) = stat($line);
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = localtime($mtime);
$year = $year + 1900;
$mon = $mon +1;
printf ("%.4d%.2d%.2d%.2d%.2d%.2d",$year,$mon,$mday,$hour,$min,$sec);
$mtime_string = localtime($mtime);
print "-$mtime-";
print "$days[$wday]-";
print "$months[$mon-1]-";
printf ("%.2d-%.2d:%.2d:%.2d-%.4d",$mday,$hour,$min,$sec,$year);
}
'
}
mkdir -p $SNAPSHOTS
if [ -d $SNAPSHOTS/latest ]
then
T=`mtime $SNAPSHOTS/latest`
echo "making snapshot $T"
cp -al $SNAPSHOTS/latest $SNAPSHOTS/$T
fi
LOG=/tmp/.log$$
rm -fr $LOG
date > $LOG
rsync -vaW --delete --exclude '*.glimpse*' --delete-excluded \
--modify-window 61 $DIR/ $SNAPSHOTS/latest/ >> $LOG
mv $LOG $SNAPSHOTS/latest/.snapshotlog
touch $SNAPSHOTS/latest
- Re: [gentoo-user] Backups? MadMax
- Re: [gentoo-user] Backu... Andrew Farmer
- [gentoo-user] Re: Backu... Michael Kunze
- [gentoo-user] Re: B... Rick [Kitty5]
- Re: [gentoo-user] Backups? Andrew Gaffney
- Re: [gentoo-user] Backups? Spider
- Re: [gentoo-user] Backu... Andrew Gaffney
- Re: [gentoo-user] Backups? Ernie Schroder
- Re: [gentoo-user] Backups? Bill Kenworthy
- Re: [gentoo-user] Backu... Ernie Schroder
- Re: [gentoo-user] Backups? HvR
- Re: [gentoo-user] Backups? Spider
- Re: [gentoo-user] Backups? Hemmann, Volker Armin
- Re: [gentoo-user] Backups? Paulo Jorge de Oliveira Cantante de Matos