SVN & TRAC Backup

After a few server crashes I had to write this very same script each time so I better keep it up here and maybe someone find it useful

1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh
 
PREFIX=/var/develbackup
SVNFOO=/home/svnuser/repos/foo
TRACFOO=/home/svnuser/trac-env/foo
 
DATE=$( date +%Y%m%d )
BACKUPDIR=backup-${DATE}
 
mkdir ${PREFIX}/${BACKUPDIR}
 
svnadmin dump ${SVNFOO} | gzip > ${PREFIX}/${BACKUPDIR}/svn-foo.dump.gz
trac-admin ${TRACFOO} hotcopy ${PREFIX}/${BACKUPDIR}/trac-foo

And the crontab line is as follows:

1
30 22 * * * /home/svnuser/develbackup.sh