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/
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)
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.
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.
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
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.
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