batch-filesvnbackupvisualsvn-serversvnsync

use svnsync for backup


I want use svnsync for create a back-up copy of my svn repository.

The svnsync command replicates all versioned files, and their attendant svn properties. It does not copy hooks or conf directories from the source repository, so I will need to do those manually.

I have wrote this batch script for create the backup repository:

setlocal enableextensions enabledelayedexpansion

:: create local backup project
svnadmin create C:\Repositories\Test

:: initialize local backup project with remote project 
svnsync initialize https://local.com/svn/Test https://remote.com/svn/Test

:: get remote info project and store in info.txt
svn info https://remote.com/svn/Test>info.txt

:: get remote UUID project from info.txt
set UUID=
for /f "delims=" %%a in (info.txt) do (
    set line=%%a
    if "x!line:~0,17!"=="xRepository UUID: " (
        set UUID=!line:~17!
    )
)
:: set local UUID project with the remote UUID project 
svnadmin setuuid C:\Repositories\Test %UUID%

:: sync local and remote project
svnsync sync https://local.com/svn/Test https://remote.com/svn/Test

endlocal

I have wrote this batch script for synchronize the backup repository with master repository (hourly schedule):

svnsync sync https://local.com/svn/Test https://remote.com/svn/Test

Say, if I set up a mirror svn repo via svnsync, and if my production svn server crashed, then how can i restore the production svn repo via the mirror? Is it possible?

Can someone suggest the best practice of backing up the production server using svnsync?


Solution

  • There are several options that are better than using svnsync: