alternative svn backup method

alternative svn backup method. Sometimes svnsync, hotcopy, etc just won’t work for you. Here’s the solution!

1. Create a user with same name and password on each of your servers, example:
host1_live_svn_server – backup_usr
host2_backup_server – backup_usr
2. Setup SSH with no password for each user that will be involved in syning your svn
3. edit /etc/group and add backup_usr to whatever group owns /usr/local/svn (assuming that is your svn install dir)
4. Install rsync on each server
5. test this command (you can ctrl + c if successful):
host1_live_svn_server# ssh [email protected]_backup_server rsync -avK [email protected]_live_svn_server:/usr/local/svn/* /usr/local/svn
(if this errors out try putting a \ in front of the *)

Create a new file called backupsvn.sh:

#!/usr/local/bin/bash
/usr/local/sbin/apachectl -k stop
host1_live_svn_server# ssh [email protected]_backup_server rsync -avK [email protected]_live_svn_server:/usr/local/svn/* /usr/local/svn
/usr/local/sbin/apachectl -k start

Place the file in cron so you can backup svn nightly!

If you receive error message:
ssh: No match.

You need to take the following steps:
ssh in to each server (server1 to server2 and vise versa) and accept:
1. the RSA key
2. chsh -s /usr/local/bin/bash
3. Make sure rsync is installed on both servers (‘which rsync’)
4. if this keeps happening you probably change the fully qualified domain name or ip of where you were connecting, please set up ssh with no password again http://brakertech.com/add-public-ssh-key-to-remote-server-in-a-single-command/

If you get any permissions errors with rsync be sure to add your user to /etc/group under whatever group owns the svn files

Leave a Reply

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>