当前位置:网站首页>SVN完全备份svnadmin hotcopy
SVN完全备份svnadmin hotcopy
2022-07-03 16:58:00 【星哥玩云】
利用svnadmin hotcopy可以实现完全备份,但不能进行增量备份。svnadmin hotcopy是将整个库都“热”拷贝一份出来,包括库的钩子脚本、配置文件等;任何时候运行这个脚本都得到一个版本库的安全拷贝,不管是否有其他进程正在使用版本库。
优点是:备份过程较快,灾难恢复也很快;如果备份机上已经搭建了svn服务,甚至不需要恢复,只需要进行简单配置即可切换到备份库上工作。
缺点是:比较耗费硬盘,需要有较大的硬盘支持。
备份命令:
svnadmin hotcopy /path/to/repository /path/to/backup
1)定义备份策略 备份频度:每天进行一次全量备份。 备份地点:备份目录以当前时间命名,备份路径到/data/svnbackup/。 备份保留时期:保留7天,超过7天的进行删除。 备份时间:每晚11点59分开始。 备份检查:备份完毕后自动检查备份是否正确、记录日志。 2)建立备份脚本
在/data/shells目录建立备份脚本svnbak.sh,假如svn仓库路径为/data/svn,要备份到/data/svnbackup/:
#!/bin/bash
#
# Filename: svnbak.sh
# Revision: 1.0
# Date: 2014/11/07
# Author: Qicheng
# Email:
# Website:
# Description: SVN完全备份
# Notes: 将脚本加入crontab中,每天定时执行
#
MAXDAYS=7 # 备份保留最大天数
TIME=`date +'%Y%m%d%H%M%S'`
SVNPATH=/data/svn # 定义仓库repos路径
BAKDIR=/data/svnbackup # 定义备份主目录
BAKSUBDIR=${BAKDIR}/${TIME} # 定义全备路径
BAKLOG=${BAKDIR}/${TIME}.log # 定义备份日志
[ ! -f "${BAKSUBDIR}" ] && mkdir -p ${BAKSUBDIR}
exec 1>${BAKLOG}
exec 2>&1
set -x
# 删除历史备份
find ${BAKDIR} -maxdepth 1 -type f -mtime +$(expr ${MAXDAYS} - 1) -exec echo "Delete {}" \; -exec rm "{}" \;
# 全备份
svnadmin hotcopy ${SVNPATH} ${BAKSUBDIR}
# 如果能打印版本号说明备份正确
svnlook youngest ${BAKSUBDIR}
[ $? -ne 0 ] && exit 1
cd ${BAKDIR}
# 压缩备份
tar cvzf ${TIME}.tar.gz ${TIME}/
rm -rf ${BAKSUBDIR}
# 可以通过rsync把备份文件同步到远程备份机上,此处省略。
测试一下:
3)设置定时crontab
每天23点59分开始执行脚本:
59 23 * * * /bin/bash /data/shells/svnbak.sh
边栏推荐
- What material is sa537cl2 equivalent to in China? Sa537cl2 corresponding material
- visual studio “通常每个套接字地址(协议/网络地址/端口)只允许使用一次“
- Kotlin learning quick start (7) -- wonderful use of expansion
- Central South University | through exploration and understanding: find interpretable features with deep reinforcement learning
- 大消费企业怎样做数字化转型?
- CC2530 common registers for crystal oscillator settings
- MySQL user management
- What is the pledge pool and how to pledge?
- What material is sa537cl2? Analysis of mechanical properties of American standard container plate
- 汇编实例解析--实模式下屏幕显示
猜你喜欢

Build your own website (23)

大变局!全国房价,跌破万元大关

13mnnimo5-4 German standard steel plate 13MnNiMo54 boiler steel 13MnNiMo54 chemical properties

What material is sa537cl2 equivalent to in China? Sa537cl2 corresponding material

What is the maximum number of concurrent TCP connections for a server? 65535?

Idea configuration plug-in

Simulink oscilloscope data is imported into Matlab and drawn
![[JDBC] API parsing](/img/75/0f69a4e246a571688355bb13e2cd73.jpg)
[JDBC] API parsing

Why is WPA3 security of enterprise business so important?

The word backspace key cannot delete the selected text, so you can only press Delete
随机推荐
爱可可AI前沿推介(7.3)
[combinatorics] recursive equation (constant coefficient linear homogeneous recursive equation | constant coefficient, linear, homogeneous concept description | constant coefficient linear homogeneous
Informatics Olympiad all in one YBT 1175: divide by 13 | openjudge noi 1.13 27: divide by 13
The largest matrix (H) in a brush 143 monotone stack 84 histogram
Hands on in-depth learning notes (XIV) 3.7 Simple implementation of softmax regression
Bcvp developer community 2022 exclusive peripheral first bullet
聊聊接口优化的几个方法
The word backspace key cannot delete the selected text, so you can only press Delete
One brush 145 force deduction hot question-2 sum of two numbers (m)
免费数据 | 新库上线 | CnOpenData中国保险中介机构网点全集数据
IDEA-配置插件
MySQL single table field duplicate data takes the latest SQL statement
Squid 服务启动脚本
Meituan side: why does thread crash not cause JVM crash
CC2530 common registers for timer 1
C language modifies files by line
visual studio “通常每个套接字地址(协议/网络地址/端口)只允许使用一次“
数据分析必备的能力
匯編實例解析--實模式下屏幕顯示
[combinatorics] polynomial theorem (polynomial coefficients | full arrangement of multiple sets | number of schemes corresponding to the ball sub model | polynomial coefficient correlation identity)