[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

simple ftp backup script

From: Mark Proctor (mproctor) <mproctor_at_cisco.com>
Date: 2003-07-08 14:47:54 CEST

I have made a simple backup script, you might want to use it as an
example - I know as a newbie that it took me some time to do, and if it
had been in an FAQ or something I would have saved a lot of time. A
nyway you can include it or leave it out, up to you.
 
I found an issue with hot-back.py (under Mandrake 9.1) , I couldn't
execute it during the http session, some environment issues - it
couldn't find the required modules to import. I would "su apache" and
it worked fine, execute it via an http commit hook and it would fail. I
made sure paths where the same in both environments - still didn't work.
To make it work I changed the top line to invoke python directly
old: #!/usr/bin/env python
new: #!/usr/bin/python
 
Regards
 
Mark
--------------------------
execute it from post-commit with:
svnbackup $REPOS $REV
--------------------------
#!/bin/bash
 
REPOSPATH="$1"
REV="$2"
REPOSNAME=$(basename $REPOSPATH)
#DATE=$(date --iso-8601='minute') #colon causes too much trouble
DATE=$(date +%Y-%m-%d+%H-%M-%S)
BACKUPPATH=/var/backup/svn
 
hot-backup.py $REPOSPATH $BACKUPPATH
 
REPOSOLD=$BACKUPPATH/$REPOSNAME-$REV
REPOS=$BACKUPPATH/$REPOSNAME-$REV-$DATE
mv $REPOSOLD $REPOS
 
tar --use-compress-program bzip2 -cf $REPOS.tar.bz2 $REPOS
rm -rf $REPOS
 
lftp -c "open ftp://xxx:xxx@domain/svn_backup/; put $REPOS.tar.bz2" &

 
Received on Tue Jul 8 14:55:43 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.