#!/bin/sh
##Subversion的安装目录及执行文件
SVN_HOME=/usr/local/subversion/bin
SVN_ADMIN=$SVN_HOME/svnadmin
SVN_LOOK=$SVN_HOME/svnlook
##配置库根目录
SVN_REPOROOT=/zsvn/svnroot
##备份文件存放路径
date=$(date '+%Y%m%d')
BAK_STORE=/zsvn/bakdump/$date
if [ ! -d "$BAK_STORE" ];then
mkdir -p $BAK_STORE
fi
##日志存放目录
Log_PATH=/zsvn/bakdumplog
if [ ! -d "$Log_PATH" ];then
mkdir -p $Log_PATH
fi
##读取项目库列表
cd $SVN_REPOROOT
for name in $(ls)
do
if [ ! -d "$BAK_STORE/$name" ];then
mkdir $BAK_STORE/$name
fi
cd $BAK_STORE/$name
if [ ! -d "$Log_PATH/$name" ];then
mkdir $Log_PATH/$name
fi
echo ******Starting backup from $date****** >> $Log_PATH/$name/$name.log
echo ******svn repository $name startting to backup****** >> $Log_PATH/$name/$name.log
$SVN_LOOK youngest $SVN_REPOROOT/$name > $Log_PATH/A.TMP
UPPER=`head -1 $Log_PATH/A.TMP`
##取出上次备份后的版本号,并做+1处理
NUM_LOWER=`head -1 $Log_PATH/$name/last_revision.txt`
let LOWER="$NUM_LOWER+1"
##开始做增量备份并记录$UPPER,为下次备份做准备
$SVN_ADMIN dump $SVN_REPOROOT/$name -r $LOWER:$UPPER --incremental > $BAK_STORE/$name/$LOWER-$UPPER.dump
rm -f $Log_PATH/A.TMP
echo $UPPER > $Log_PATH/$name/last_revision.txt
echo ******This time we bakcup from $LOWER to $UPPER****** >> $Log_PATH/$name/$name.log
echo ******Back up ended****** >> $Log_PATH/$name/$name.log
done
*********************************************************************************************
#!/bin/sh
##Subversion的安装目录及执行文件
SVN_HOME=/usr/local/subversion/bin
SVN_ADMIN=$SVN_HOME/svnadmin
SVN_LOOK=$SVN_HOME/svnlook
##配置库根目录
SVN_REPOROOT=/zsvn/svnroot
##备份文件存放路径
date=$(date '+%Y%m%d')
BAK_STORE=/zsvn/bakfull/$date
if [ ! -d "$BAK_STORE" ];then
mkdir -p $BAK_STORE
fi
##读取项目库列表
cd $SVN_REPOROOT
for name in $(ls)
do
##开始做全量备份
$SVN_ADMIN hotcopy $SVN_REPOROOT/$name $BAK_STORE/$name
##Subversion的安装目录及执行文件
SVN_HOME=/usr/local/subversion/bin
SVN_ADMIN=$SVN_HOME/svnadmin
SVN_LOOK=$SVN_HOME/svnlook
##配置库根目录
SVN_REPOROOT=/zsvn/svnroot
##备份文件存放路径
date=$(date '+%Y%m%d')
BAK_STORE=/zsvn/bakdump/$date
if [ ! -d "$BAK_STORE" ];then
mkdir -p $BAK_STORE
fi
##日志存放目录
Log_PATH=/zsvn/bakdumplog
if [ ! -d "$Log_PATH" ];then
mkdir -p $Log_PATH
fi
##读取项目库列表
cd $SVN_REPOROOT
for name in $(ls)
do
if [ ! -d "$BAK_STORE/$name" ];then
mkdir $BAK_STORE/$name
fi
cd $BAK_STORE/$name
if [ ! -d "$Log_PATH/$name" ];then
mkdir $Log_PATH/$name
fi
echo ******Starting backup from $date****** >> $Log_PATH/$name/$name.log
echo ******svn repository $name startting to backup****** >> $Log_PATH/$name/$name.log
$SVN_LOOK youngest $SVN_REPOROOT/$name > $Log_PATH/A.TMP
UPPER=`head -1 $Log_PATH/A.TMP`
##取出上次备份后的版本号,并做+1处理
NUM_LOWER=`head -1 $Log_PATH/$name/last_revision.txt`
let LOWER="$NUM_LOWER+1"
##开始做增量备份并记录$UPPER,为下次备份做准备
$SVN_ADMIN dump $SVN_REPOROOT/$name -r $LOWER:$UPPER --incremental > $BAK_STORE/$name/$LOWER-$UPPER.dump
rm -f $Log_PATH/A.TMP
echo $UPPER > $Log_PATH/$name/last_revision.txt
echo ******This time we bakcup from $LOWER to $UPPER****** >> $Log_PATH/$name/$name.log
echo ******Back up ended****** >> $Log_PATH/$name/$name.log
done
*********************************************************************************************
#!/bin/sh
##Subversion的安装目录及执行文件
SVN_HOME=/usr/local/subversion/bin
SVN_ADMIN=$SVN_HOME/svnadmin
SVN_LOOK=$SVN_HOME/svnlook
##配置库根目录
SVN_REPOROOT=/zsvn/svnroot
##备份文件存放路径
date=$(date '+%Y%m%d')
BAK_STORE=/zsvn/bakfull/$date
if [ ! -d "$BAK_STORE" ];then
mkdir -p $BAK_STORE
fi
##读取项目库列表
cd $SVN_REPOROOT
for name in $(ls)
do
##开始做全量备份
$SVN_ADMIN hotcopy $SVN_REPOROOT/$name $BAK_STORE/$name
done
本文转自 guowang327 51CTO博客,原文链接:http://blog.51cto.com/guowang327/1739146,如需转载请自行联系原作者