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

svnbackup.py

From: Martin Furter <mf_at_rola.ch>
Date: 2006-02-07 23:30:52 CET

Hello

Attached is a backup script for use in post-commit hooks and cron jobs.
I'd like to have it included in subversion under tools/hook-scripts (or
contrib if you prefer that).

Since i have partial commit access now i can commit it myself, but i need
permission first, and some input. And ofcourse i will continue maintaining
the script.

So let's start with the story first:

About two years ago i installed subversion on one of the servers at the
company where i work and moved the code i work on to svn. I knew the first
question will be "and what about backups?" so i wrote a shell script which
made weekly full dumps and transferred them onto another server.

Six month later almost all projects have been moved to subversion, and
about a 15 month later these full dumps grew to more than 1GB, which
caused the disks to fill up pretty fast.

So i had to write a better backup script: svnbackup.py.

Now i run the following command in the weekly cronjob:

svnbackup.py -c 1000 -z /srv/svn/src /srv/svn_backup

The -c N option is the count of revisions per dumpfile, -z is for gzip.
When started the first time and HEAD is at 2923 it creates the following
files:

src.000000-000999.svndmp.gz
src.001000-001999.svndmp.gz
src.002000-002923.svndmp.gz

Say the next time HEAD is at 3045 it creates these two files:

src.002000-002999.svndmp.gz
src.003000-003045.svndmp.gz

It has a few more options, for example -r for dumping single revision from
a post-commit hook or -t to transfer the created dumpfiles to another
server using FTP (not well tested) or SMB (well tested).

The script needs python 2.4 because it uses the package 'subprocess'. I
wrote a simple compatibility function for an other tool which could be
used here too to make it run on python 2.3 and below but i don't know if
it's worth the effort.

Another problem is that the script creates temporary dump files when using
the gzip option. It would be better to pipe the output of svnadmin dump
directly into gzip, if would consume less disk space and even run faster
on my solaris box.

I've never tested the script on windows so i guess it will not work there.

Does anyone object to commit it to tools/contrib (after adding the
collabnet license) ?
Any other suggestions or wishes?

Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Received on Tue Feb 7 23:31:35 2006

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

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