[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Backup and Incremental Backup Perl Scripts

From: Aniruddha Apte <aniapte_at_gmail.com>
Date: 2005-05-19 07:51:01 CEST

Here's what we use for everyday backup. You'll need to put it in a cron job.
#!/usr/bin/perl

use strict;

my $last_backup;
my $youngest;
my $from_rev;
my @lines;
my $status;
my $dumpfile;
my $svnadmin_dump;

@lines = `ls -tl /dumps/dump-r*`;

$_ = $lines[0];
if (/[0-9]+$/)
{
        $last_backup = $&;
        $from_rev = $last_backup + 1;
}
else
{
        $from_rev = 0;
}

$youngest = `svnlook youngest /project/svn/phone`;
chomp($youngest);

if ($youngest == $last_backup)
{
        print "Already backed up till youngest revision r$youngest.\n";
        exit;
}

print "Backed up previously till r$last_backup\n";
print "Youngest revision now is r$youngest\n";
print "Backing up from r$from_rev to r$youngest in file
dump-r$from_rev-r$youngest\n";

$dumpfile = "/project/svn/backups/dump-r$from_rev-r$youngest";
$svnadmin_dump = "svnadmin dump /project/svn/phone -r
$from_rev:$youngest --incremental --deltas > $dumpfile";
$status = system($svnadmin_dump);

print "\n-------------------------------\nsvndump output = $status\n";

On 18/05/05, Hughes, Trystan <Trystan.Hughes@assetco.com> wrote:

> can anyone please share any possible Perl (or even Python) scripts that you or a colleague may have created to backup a Subversion repository (including incremental scripts)?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu May 19 07:52:50 2005

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.