Updated svnbackup.sh to backup TRAC environment with SVN

This commit is contained in:
Matthew McKinnon 2015-07-22 16:42:06 +10:00
parent 2e539a5735
commit 1200f6792b

View File

@ -1,9 +1,10 @@
#!/bin/bash #!/bin/bash
bakdate=$(date +%Y%m%d%H%M) bakdate=$(date +%Y%m%d)
bakdest="/BACKUP/svn/" bakdest="/BACKUP/svn/"
svnrepos="/var/lib/svn" svnrepos="/var/lib/svn"
tracrepos="/var/lib/trac"
rotate_backups() { rotate_backups() {
find $backdest -type f -mtime +7 -exec rm -frv {} \; find $backdest -type f -mtime +7 -exec rm -frv {} \;
@ -14,9 +15,17 @@ rotate_backups
cd $svnrepos cd $svnrepos
if [ -d "$bakdest" ] && [ -w "$bakdest" ] ; then if [ -d "$bakdest" ] && [ -w "$bakdest" ] ; then
for repo in *; do for repo in *; do
svnadmin dump $repo > $bakdest/$repo-$bakdate.svn.dump mkdir /tmp/$repo
svnadmin dump $repo > /tmp/$repo/$repo-$bakdate.svn.dump
trac-admin $tracrepos/$repo hotcopy /tmp/$repo/$repo-trac-$bakdate
cd /tmp/
tar -zcf $bakdest/$repo-$bakdate.tar.gz $repo/*
rm -fr /tmp/$repo
cd $svnrepos
done done
fi fi