Neosavvy, Inc Modern Knowledge Blog

22Dec/090

Automating SVN Backups

Today I read a post on coding horror about catastrophic disk failure and thought to myself that I should wake up every day and think of some way to automate a piece of infrastructure to prevent myself from reaching a point of failure on losing important data.

So today I wrote a simple backup script for my svn repository and exposed the dumps via HTTPD in a directory alias.

1) The backup script:

#!/bin/bash
startRepositoryRevision=0
latestRepositoryRevision=`svn info http://www.neosavvy.com/svn/neosavvy/ | grep Revision | cut -d " " -f 2| tr -d '\r'`
/usr/bin/svnadmin dump /home/svn/neosavvy > /svndump/neosavvy.svn.dump.$startRepositoryRevision-$latestRepositoryRevision.$(date +%Y.%m.%d)

2) Crontab Entry: (crontab -e)

0 */4 * * * /root/bin/dumpNeosavvySvn.sh

3) Apache Directory Alias to expose it to some other automagic script that will download the files to another location

Alias /svndump /svndump
<Directory /svndump>
Options Indexes
Order allow,deny
Allow from all
</Directory>

The dumps are available here: http://www.neosavvy.com/svndump/

That's it a short useful documentation of something I think will improve the infrastructure of things I work on every day. As I add to the script I will document the process in this post.

Thanks for reading.

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.

Pages

Categories

Blogroll

Archive

Meta