So let’s say you already have working SVN repo and want to setup svnsync to have backup on another server. Here are the steps I did to make it working:
- Dump existing repo:
123svnadmin dump /home/svn > /home/svn.dump#gzip on the fly if you have big reposvnadmin dump /home/svn | gzip -9 > /home/svn.dump.gz - Transfer it to backup server (extract if you used gzip in previous step):
12scp /home/svn.dump.gz backup:/home/root@backup# gzip -d /home/svn.dump.gz - Load the dump into repo:
123456cd /homesvnadmin create svnsvnadmin load /home/svn < /home/svn.dump#after loading paste to hooks/pre-revprop-changeecho " - Create hooks/pre-revprop-change:
1vim /home/svn/hooks/pre-revprop-change
Paste into file:
12#!/bin/shexit 0
Make file executable:
1chmod +x /home/svn/hooks/pre-revprop-change - Get repository UUID:
1svn info https://mainserver/svn
You will get something like:
12345678910Path: reposURL: https://mainserver/svnRelative URL: ^/Repository Root: https://mainserver/svnRepository UUID: b104dc52-766c-5412-a351-c523fa6b150cRevision: 203Node Kind: directoryLast Changed Author: adminLast Changed Rev: 203Last Changed Date: 2014-09-20 10:04:23 +0200 (Sat, 20 Sep 2014)
Copy UUID and paste into next command:
1svn propset --revprop -r0 svn:sync-from-uuid b104dc52-766c-5412-a351-c523fa6b150c - Now init the mirror repo:
1svnsync init --allow-non-empty file:///home/svn https://mainserver/svn - And finally sync it:
1svnsync sync file:///home/svn - Now you can setup cronjob to keep it syncing automatically e.g. every 5min. Use my script wrapper to avoid running two syncs at same time