SVN automates full-scale backup (Windows Server)

Source: Internet
Author: User

One, SVN full-scale backup script:

1) New file Backup.bat , open the editor and enter the following:

echo off

installation directory for REM subversion

Set svn_home="C:\Program Files (x86) \visualsvn Server"


REM Parent directory for all repository

Set svn_root=D:\Repositories


The list of REM backups

Set backup_svn_root=D:\SvnBak (note: Where the red logo is modified according to the actual situation)


REM Create a temporary directory that holds the repository

Set backup_directory=%backup_svn_root%\%date:~0,10%

If exist%backup_directory% goto Checkback

Echo%date:~0,10%%time:~0,-3%: Creating a backup directory%backup_directory%>>%svn_root%/backup.log


REM Create backup directory

MD%backup_directory%


REM verifies that the directory is a repository, and if yes, take out the name backup

FOR/R%svn_root%%%i in (.) does @if exist "%%i\conf\svnserve.conf" Call%svn_root%\simplebackup.bat "%%~fi"%%~ni

Echo starts compressing the repository, please do not abort ....


%svn_root%\7z.exe a-tzip%backup_svn_root%\%date:~0,10%. zip %backup_directory%\*-R >nul

Echo Version Library compression complete!

xcopy D:\svnbak\%date:~0,10%.zip \\IP address \ Folder

(Note: This sentence is to copy the local backup to other paths 7Z.exe can also be replaced with WinRAR.exe, WinRAR.exe into the repositories, the target path if the server, you need to map to the local (note, need to map), No need to delete this sentence)

REM Cleanup temporarily creates backup directory


CD%backup_svn_root%

rd/s/q%backup_directory%

Rem del%date:~0,10%. Zip%/s/q

Goto END

: Checkback

Echo backup directory%backup_directory% already exists, please empty it.

Goto END

: End


2) New file Simplebackup.bat , open the editor and enter the following:

@echo backing up the version library%1 ...

@md%backup_directory%\%2

@%svn_home%\bin\svnadmin hotcopy%1%backup_directory%\%2

@echo Version library%1 was successfully backed up to%2!


3) Put the above two scripts and the compression software. exe into repositories


Second, the realization of fixed-point automatic backup:

Open "Task Scheduler" (Windows7 under Administrative tools), make "Create Task Schedule", create my execution plan repeatedly failed, execute script can, but do not automatically execute, when the security option to run the task, the original selected "regardless of whether the user is logged on to run, use the highest permissions", in the change to " Run only when the user logs on "Instead, even if you turn off Remote Desktop, you don't know why.

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= "http ://s1.51cto.com/wyfs02/m00/7a/10/wkiom1ah1wxx8fw9aadvsggqusa127.png "title=" 25.png "alt=" Wkiom1ah1wxx8fw9aadvsggqusa127.png "/>


An xcopy command is also attached:

xcopy D:\Svnbak \\192.168.1.1\yidibeifen\%date:~0,4%_%date:~5,2%_%date:~8,2%\/e/y

CD/D D:\Svnbak

del */s/q

This is the local backup all content under Svnbak is uploaded to 192.168.1.1\yidibeifen the date as a folder, and delete all content under local backup Svnbak


SVN automates full-scale backup (Windows Server)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.