Svnsync server code backup

Source: Internet
Author: User

SVN server backup

Last night, I suddenly came up with a question: What should I do if the hard disk Of My SVN server is broken? Isn't the code all lost,

I checked it online and found many ways to back up the svn server. I tried to synchronize the code in the code library with Sync:

SVN server system:

RedHat 6.4-64

SVN version:

1.6

SVN source code server address:

SVN: // 192.168.10.1/

SVN target directory:

SVN: // 192.168.10.2/

 

  1. First, install svn on the 192.168.30.2 server, create a version library, and so on. It is better to be consistent with the directory of the source code server, so it is better to back up data (I just think so)

  2. Rename the pre-revprop-change.tmpl file in the/data/SVN/repos/hooks directory of the 30.2 server

Pre-revprop-change and change Exit 1 of the last row to exit 0. Or clear the file content and write a row of exit 0.

Otherwise, the initialization will pause.

  1. Execute Initialization

Svnsync init SVN: // 192.168.10.2 SVN: // 192.168.10.1

That is, the source code library of the svnsync init target Library

Press enter and you will be asked about the username and password for logging on to the target database and source database. We recommend that you set the same username and password for the two databases.

After it is correct, it is displayed as follows:

Copied properties for Revision 0.

  1. Execute Synchronization

Svnsync sync SVN: // 192.168.10.2

That is, the target library of svnsync sync

Displayed after correct

Committed Revision 1.

Copied properties for revision 1.

Committed revision 2.

Copied properties for revision 2.

 

Committed revision 3.

Copied properties for revision 3.

 

Committed Revision 4.

Copied properties for revision 4.

 

Committed Revision 5.

Copied properties for revision 5

  1. Add the post-commit script under the hooks of the source code library.

Can copy post-commit.tmpl

That is

Cppost-commit.tmpl post-commit

Replace the content in post-commit

/Usr/local/SVN/bin/svnsync sync -- Non-interactivesvn: // 192.168.30.30/-username jiafei-Password jf123

After an update is submitted, the synchronization command is executed without interaction.

Set post-commit to 755.

PS:

If the post-commit script has an error or has no execution permission, an error is reported when an update is submitted.

  1. If the previous Code cannot be synchronized during step 5, it will be on the backup machine:

Add the svnsync. Sh script in the/usr/sbin/directory. The content is as follows:

#! /Bin/bash

/Usr/local/SVN/bin/svnsync sync -- Non-interactivesvn: // 192.168.10.2/

Add a scheduled task: crontab-e

*/1 *****/usr/sbin/svnsync. Sh>/backup/svn_sync/Sync. log 2> & 1

Synchronize code from 10.1 every minute

It is not much different from Step 5. I tried it well.

7. Here, the server address is basically OK. If your server breaks down

 


Svnsync server code backup

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.