svnsync远程备份仓库
1:安装subversion,过程省略......,由于subversion依赖的函数库未必完全安装,可能会遇到./configure 和make时出错。逐一解决即可!
[root@* home]# /usr/local/svn/bin/svnadmin create /home/backup-repository [root@* home]# ll -d backup-repository/ drwxr-xr-x 6 root root 4096 Apr 8 00:15 backup-repository/ [root@* home]# cd backup-repository/ [root@q* backup-repository]# ls conf db format hooks locks README.txt [root@* backup-repository]# cd hooks/ [root@* hooks]# ls post-commit.tmpl post-revprop-change.tmpl pre-commit.tmpl pre-revprop-change.tmpl start-commit.tmpl post-lock.tmpl post-unlock.tmpl pre-lock.tmpl pre-unlock.tmpl [root@* hooks]# cp pre-revprop-change.tmpl pre-revprop-change [root@* hooks]# ls post-commit.tmpl post-revprop-change.tmpl pre-commit.tmpl pre-revprop-change pre-unlock.tmpl post-lock.tmpl post-unlock.tmpl pre-lock.tmpl pre-revprop-change.tmpl start-commit.tmpl [root@qhtproxy240 hooks]# vi pre-revprop-change #!/bin/sh exit 0 ~
[root@* hooks]# ll pre-revprop-change -rw-r--r-- 1 root root 17 Apr 8 00:18 pre-revprop-change [root@* hooks]# chmod a+x pre-revprop-change ##添加x权限 [root@* hooks]# chmod a+w pre-revprop-change ##防止出现permission denied的问题 [root@* hooks]# chown -R backupuser /home/backup-repository
[root@* hooks]# su - backupuser
[root@* hooks]# /usr/local/svn/bin/svnsync init file:///home/backup-repository/ svn://172.*.*.*:3345/home/svnsource Copied properties for revision 0. [root@* hooks]# su - backupuser svnsync sync ###执行时间的长短和你的repository大小有很大的关系!
运行后,
cd /home
du -sh backup-repository 你会发现仓库一直在增长!
~
|
我的备份文件和内容如下:
[l5m@qht**240 ~]$ ls
crontab_job svnsync.log svnsync.sh
[l5m@qht**240 ~]$ cat svnsync.sh
echo "begin to backup svnrepository" >>/home/l5m/svnsync.log
echo " " >> /home/l5m/svnsync.log
echo " " >> /home/l5m/svnsync.log
echo `date` >> /home/l5m/svnsync.log
/usr/local/svn/bin/svnsync sync >> /home/l5m/svnsync.log 2>&1
[l5m@qht**240 ~]$ cat crontab_job
0 */1 * * * /home/l5m/svnsync.sh
[l5m@qht**240 ~]$ cat svnsync.sh
echo "begin to backup svnrepository" >>/home/l5m/svnsync.log
echo " " >> /home/l5m/svnsync.log
echo " " >> /home/l5m/svnsync.log
echo `date` >> /home/l5m/svnsync.log
/usr/local/svn/bin/svnsync sync >> /home/l5m/svnsync.log 2>&1
svnsync.log中内容:
###此内容有svn备份时自己生成的,有我自己写入进去的!
...... Thu Apr 8 04:00:01 EDT 2010 Transmitting file data .. Committed revision 44329. Copied properties for revision 44329. Transmitting file data ... Committed revision 44330. Copied properties for revision 44330. Transmitting file data . Committed revision 44331. Copied properties for revision 44331. Transmitting file data ....... Committed revision 44332. Copied properties for revision 44332. Transmitting file data .... Committed revision 44333. Copied properties for revision 44333. Transmitting file data ........ Committed revision 44334. Copied properties for revision 44334. Transmitting file data . Committed revision 44335. Copied properties for revision 44335. Transmitting file data ... Committed revision 44336. Copied properties for revision 44336. Transmitting file data . Committed revision 44337. Copied properties for revision 44337. Transmitting file data .... ...... Copied properties for revision 48809. Transmitting file data . Committed revision 48810. Copied properties for revision 48810. Transmitting file data ....... Committed revision 48811. Copied properties for revision 48811. begin to backup svnrepository ##这几行内容是我用shell脚本生成的!
Mon May 31 07:00:01 EDT 2010 Transmitting file data . Committed revision 48812. Copied properties for revision 48812. Transmitting file data .. Committed revision 48813. Copied properties for revision 48813. Transmitting file data . Committed revision 48814. Copied properties for revision 48814. Transmitting file data .... Committed revision 48815. Copied properties for revision 48815. Transmitting file data ... Committed revision 48816. Copied properties for revision 48816. Transmitting file data .. Committed revision 48817. Copied properties for revision 48817. begin to backup svnrepository ......
|
阅读(1534) | 评论(0) | 转发(0) |