摘要:
- svnadmin create myProject
- svnadmin dump /path/to/svnroot > /backup/svnBackup_20060101.dumpfile
- svnadmin load /path/to/svnroot < /backup/svnBackup_20060101.dumpfile
- svnserve -d -r /path/to/svnroot
apache的配置不顺利,总是提示打开密码文件失败,下次再试下吧
subversion.conf配置
# Needed to do Subversion Apache server.
LoadModule dav_svn_module modules/mod_dav_svn.so
# Only Needed if you decide to do "per-directory" access control.
LoadModule authz_svn_module modules/mod_authz_svn.so
#
# Example location directive.
#
<Location /svn>
DAV svn
# SVNParentPath /var/svn
SVNPath /var/svn/projects
AuthType Basic
AuthUserFile /var/svn/myPass
AuthName "Authorization Realm"
Require valid-user
# AuthzSVNAccessFile /var/svn/authz
#
# # Limit write permission to list of valid users.
# <LimitExcept GET PROPFIND OPTIONS REPORT>
# # Require SSL connection for password protection.
# # SSLRequireSSL
#
# AuthType Basic
# AuthName "Authorization Realm"
# AuthUserFile /usr/svn/projects/conf/passwd
# Require valid-user
# </LimitExcept>
</Location>
2.SubVersion定期完整备份脚本(Linux) #!/bin/sh
#
# subversion data backup script
# by scud http://www.jscud.com
# 2005-11-27
#
# subversion完整备份的脚本,调整好后使用crontab -e 放到自动执行里面即可.
#
#备份日志文件
LogFile=/backup/svn/svnbak.log
DATE=`date +%Y%m%d`
#备份目录
BakDir=/backup/svn/data
#日常备份目录,如果有
DailyDir=/backup/svn/daily
#要备份的项目列表文件,只有项目名
ProjectLst=/backup/svn/project.lst
#所有项目都保存在这个目录下
SvnDir=/var/svn
#svnadmin程序的路径
SVNADMIN=/usr/bin/svnadmin
echo " " >> $LogFile
echo " " >> $LogFile
echo "-------------------------------------------" >> $LogFile
echo $(date +"%y-%m-%d %H:%M:%S") >> $LogFile
echo "--------------------------" >> $LogFile
cd $BakDir
#读取项目列表
PROJECTLIST=`cat $ProjectLst`
for project in $PROJECTLIST
do
projectdata=$SvnDir/$project
destdir=$BakDir/$project
dumpfile=$DATE.$project.tgz
if [ -f $BakDir/$dumpfile ]
then
echo "backup file have exist!" >>$LogFile
else
$SVNADMIN hotcopy $projectdata $destdir --clean-logs
tar czvf $dumpfile $destdir >/dev/null
rm -fr $project
echo "backup $project done into $dumpfile ">>$LogFile
fi
## delete old tgz 此处根据crontab的时间调整,例如一周一次备份,此处保留了5份备份,以前的删除
oldfile="$BakDir/"$(date +%y%m%d --date=’28 days ago’).$project.tgz
if [ -f $oldfile ]
then
rm -f $oldfile >> $LogFile 2>&1
echo "[$oldfile]Delete Old File Success!" >> $LogFile
else
echo "[$oldfile]No Old Backup File!" >> $LogFile
fi
done
#delete previous daily backup files
cd $DailyDir
rm -f *