svn备份脚本

#!/bin/bash
SRCPATH=/data/svnrepos/softdev/; #定义仓库parent路径
DISTPATH=/data/svnbak/full/`date +%Y%m%d%H%M`/ ; #定义存放路径;
DISTPATH2=/data/svnbak/tar/

mkdir -p $DISTPATH
echo $DISTPATH
svnadmin hotcopy $SRCPATH $DISTPATH

tar -zcPvf $DISTPATH2/$(date +%Y%m%d%H%M).tar.gz $DISTPATH

cd /data/svnbak/full/
rm -rf /data/svnbak/full/*

cd $DISTPATH2
find $DISTPATH2/ -mtime +3 -name "*.tar.gz" -exec rm -rf {} \;

相关推荐