Svn – Subversion backup dump – just need something very simple

svn

I have this command that I'm told will do a full backup of Subversion (tell me if that's not true):

svnadmin dump /shared/svnrepos | gzip /shared/backup/snvfull.svn.gz

I'm not a Linux person. I just simply want it to run nightly at 7pm and overwrite the file nightly. It takes quite a while to run though (around 4-5 hours creating around a 28GB file)

Can someone please tell me how to set it up as a cron job in Linux as the root user? (It's Gentoo if that matters)

If it's easier to run a Windows task from the "backup server" just let me know how to create that task to remote in via SSH and run that command as the root user.

Thank you!

P.S. if there's a better/easier way to backup a large SVN, please let me know…I know nothing about Subversion but I'm still stuck dealing with it.

Best Answer

Your command will work.

Create a dump script such as svndump.sh

#!/bin/bash
date=`date +%Y-%m-%d`
svnadmin dump /shared/svnrepos | gzip /shared/backup/snvfull_$date.svn.gz

Edit Crontab file crontab -e add

0 19 * * * root /path-to-svn-dump/svndump.sh file 

every day at 7pm this will dump your file

On windows create a bat file such as

for /F "tokens=6,7,8 delims=/ " %%i in ('echo.^|date^|find "current" ') do set today=%%k%%j%%i

set backupdate=%today%
cd "C:\backups\svn"

svnadmin dump "C:\svn_repository\your_repo" > "C:\backups\svn\yourbackup_%backupdate%.svn"

Add this file to scheduled jobs for desired time to run.

Related Topic