#!/bin/sh
##Subversion的安裝目錄及執(zhí)行文件
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,為下次備份做準(zhǔn)備
$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的安裝目錄及執(zhí)行文件
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