Backing up a Subversion (SVN) Repository
Here are some crude cron jobs I use to create nightly backups of svn repositories on the server (which will then get backed up elsewhere as part of the server backup).
The nightly backup will get overwritten each night, but a weekly backup is kept permanently.
When I say crude, they work fine for a quick job, but they are limited:
That said, here we go:
# At 01:05 each day, dump the repository to a file:
5 1 * * * svnadmin dump /home/svn/my_repository 2>/dev/null | gzip > ~/svn-backups/my_repository.svn.gz
# At 01:15 each Saturday, dump the repository out to a unique file:
15 1 * * 6 DATE=$(date +"%Y-%m-%d"); svnadmin dump /home/svn/my_repository 2>/dev/null | gzip > ~/svn-backups/week/my_repository-$DATE.svn.gz