备份svn数据脚本
#!/bin/bash
#james.liu
#Mon Apr 22 21:26:45 EDT 2019
#############
svnBackupDataFileDir="/opt/svnBackup/"
repo="code doc java test"
backup(){
for i in $repo
do
if [ ! -d $svnBackupDataFileDir$i ];then
mkdir -p $svnBackupDataFileDir$i
else
echo "$svnBackupDataFileDir$i目录已存在"
fi
svnadmin dump /www/svndata/$i > $svnBackupDataFileDir$i/$i.`date +%F`.bak
done
}
delfile(){
find $svnBackupDataFileDir -type f -ctime +7 -exec rm -rf {} \;
}
Rollback(){
read -p "input new repo name " name
read -p "input Rollback repo name " reponame
svnadmin load /www/svndata/$name <reponame
}
backup
delfile
定期执行
crontab -e
#svn 每日备份并定时删除
0 2 * * * /SHELL/svnBackup
网友评论