SVN access error after svnadmin dump

apache-2.2backupsvn

I was looking for a way to backup all our SVN repositories, and came across this:
http://www.darcynorman.net/2006/04/05/automatically-backing-up-multiple-subversion-repositories/

Because our repositories are organized in a client / project directory structure, i changed the script into this:

#!/bin/sh

SVN_REPOSITORIES_ROOT_DIR="/var/svn/repos/"
BACKUP_DIRECTORY="/home/hyperactive/public_html/svn/"

for CLIENT in `ls -1 $SVN_REPOSITORIES_ROOT_DIR`
do

echo 'dumping client: ' $CLIENT
mkdir $BACKUP_DIRECTORY/$CLIENT

for REPOSITORY in `ls -1 $SVN_REPOSITORIES_ROOT_DIR/$CLIENT`
do

echo 'dumping repository: ' $REPOSITORY
svnadmin dump $SVN_REPOSITORIES_ROOT_DIR$CLIENT/$REPOSITORY | gzip > $BACKUP_DIRECTORY$CLIENT/$REPOSITORY'.gz'

done

After running it (it completed the backup successfully), i get the following error on every repository that was to be backed up:

<m:human-readable errcode="2">
Could not open the requested SVN filesystem
</m:human-readable>

I looked in the apache error log, and this is what i found:

(20014)Internal error: Can't open file '/var/svn/repos/Test2/Test3.gz/format': No such file or directory, referer: http://10.4.2.254/svn/Test2

The way i see it, somehow the backup script added the .gz at the end of the repo path ([…]Test2/Test3**.gz**). After further cheking i noticed the single quotes surrounding the .gz extension in the script.

Any thoughts ?

Best Answer

Ok, i'm feeling very embarassed right now ... it seems that everything was ok, but since i had the brilliant idea of saving the backups in public_html/ with the exact same directory structure as the repositories, and had a in an Apache conf file, somehow the .gz files were being treated as repositories.

To clarify, i had the following structure for the backups:

public_html/
    svn/
        CLIENT/
            PROJECT.gz

... and this one for the repositories:

/var/svn/repos/
    CLIENT/
        PROJECT/

in a Apache conf file i had:

<Location /svn>
    DAV svn
    [...]

When navigating with the browser to /svn, i encountered the specified error. Renaming or moving the backup folder from public_html/ solved the problem and made me feel stupid.