自动定期导出版本库进行备份。对早期比较小巧的版本库比较适用。可以将导出的SVN版本库文件打包后发送到企业邮箱里保存。
crontab -e
* * * * * 1 /usr/local/bin/svndump > /dev/null 2>&1
/usr/local/bin/svndump
#!/bin/bash #~ 自动导出版本版库,发送到企业邮箱进行备份 today=$(date -d today +%Y-%m-%d) repos="/home/repos" path_dir="${repos}/${today}" if [ ! -d ${path_dir} ]; then mkdir ${path_dir} fi svnadmin dump ${repos}/mg.b2b > ${path_dir}/mg.b2b.dmp svnadmin dump ${repos}/member > ${path_dir}/member.dmp svnadmin dump ${repos}/res > ${path_dir}/res.dmp svnadmin dump ${repos}/imgserv > ${path_dir}/imgserv.dmp tar -czvf ${repos}/${today}.tgz ${path_dir} echo "svn backup by date:${today}"|mutt -a ${repos}/${today}.tgz -s "svn backup log" -b luweihua@360b2b.com 464717761@qq.com rm -Rf ${path_dir} rm -Rf ${repos}/${today}.tgz