当前位置:网站首页>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
边栏推荐
- Central South University | through exploration and understanding: find interpretable features with deep reinforcement learning
- 汇编实例解析--实模式下屏幕显示
- MySQL Basics
- One brush 142 monotone stack next larger element II (m)
- LeetCode 1657. Determine whether the two strings are close
- 【剑指 Offer】58 - II. 左旋转字符串
- 線程池:業務代碼最常用也最容易犯錯的組件
- Processing strategy of message queue message loss and repeated message sending
- What material is sa537cl2? Analysis of mechanical properties of American standard container plate
- Informatics Olympiad all in one YBT 1175: divide by 13 | openjudge noi 1.13 27: divide by 13
猜你喜欢

word 退格键删除不了选中文本,只能按delete

Le zèbre a été identifié comme un chien, et la cause de l'erreur d'AI a été trouvée par Stanford

Fast Ethernet and Gigabit Ethernet: what's the difference?

MySQL single table field duplicate data takes the latest SQL statement

建立自己的网站(23)

Yu Wenwen, Hu Xia and other stars take you to play with the party. Pipi app ignites your summer

Atom QT 16_ audiorecorder

utfwry. Dat PHP, about ThinkPHP's method of IP location using utfwry address Library

What is the material of sa302grc? American standard container plate sa302grc chemical composition

ANOVA example
随机推荐
Assembly instance analysis -- screen display in real mode
[Jianzhi offer] 57 - ii Continuous positive sequence with sum s
C language string practice
智慧之道(知行合一)
Kotlin学习快速入门(7)——扩展的妙用
Analysis of variance summary
Network security web penetration technology
[combinatorial mathematics] recursive equation (example of recursive equation 2 Hanoi Tower | example of recursive equation 3 insertion sequencing)
mysql用户管理
Build your own website (23)
Define a structure fraction to represent a fraction, which is used to represent fractions such as 2/3 and 5/6
[2. Basics of Delphi grammar] 1 Identifiers and reserved words
The word backspace key cannot delete the selected text, so you can only press Delete
What is the difference between 14Cr1MoR container plate and 14Cr1MoR (H)? Chemical composition and performance analysis of 14Cr1MoR
Prepare for the golden three silver four, 100+ software test interview questions (function / interface / Automation) interview questions. win victory the moment one raises one 's standard
Le zèbre a été identifié comme un chien, et la cause de l'erreur d'AI a été trouvée par Stanford
SSH连接远程主机等待时间过长的解决方法
visual studio “通常每个套接字地址(协议/网络地址/端口)只允许使用一次“
[combinatorics] non descending path problem (number of non descending paths with constraints)
Daily code 300 lines learning notes day 10