Difference between revisions of "svn backup"

From Noah.org
Jump to navigationJump to search
(Created page with 'Category: Engineering Category: SVN <pre> #!/bin/sh # This creates a backup of an SVN repository. This should be run # on the repository side. After that completes a sep…')
 
m
 
Line 18: Line 18:
 
chgrp backup /home/svn/svn_backup.tar.gz
 
chgrp backup /home/svn/svn_backup.tar.gz
 
rm -rf /home/svn/svn_backup
 
rm -rf /home/svn/svn_backup
 +
</pre>
 +
 +
On the remote backup server side a cron job should be run that does this:
 +
 +
<pre>
 +
su backup -c "rsync -avz backup@svn.example.com:/home/svn/svn_backup.tar.gz /var/backups/svn_backup.tar.gz"
 
</pre>
 
</pre>

Latest revision as of 19:36, 12 March 2010


#!/bin/sh
# This creates a backup of an SVN repository. This should be run
# on the repository side. After that completes a separate process
# should be run on the remote backup server side. The remote backup 
# server should pull the backup file by running the following command:
#     rsync -avz backup@svn.example.com:/home/svn/svn_backup.tar.gz .

if [ -r svn_backup.tar.gz ] ; then
    mv -f svn_backup.tar.gz svn_backup-previous.tar.gz
fi
svnadmin hotcopy /home/svn/ /home/svn/svn_backup.tar.gz
(cd /home/svn/ && tar -svn_backup.tar svn_backup)
gzip --rsyncable /home/svn/svn_backup.tar
chgrp backup /home/svn/svn_backup.tar.gz
rm -rf /home/svn/svn_backup

On the remote backup server side a cron job should be run that does this:

su backup -c "rsync -avz backup@svn.example.com:/home/svn/svn_backup.tar.gz /var/backups/svn_backup.tar.gz"