当前位置:网站首页>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
边栏推荐
- Aike AI frontier promotion (7.3)
- [try to hack] active detection and concealment technology
- Processing strategy of message queue message loss and repeated message sending
- 在iptables防火墙下开启vsftpd的端口
- 浅谈拉格朗日插值及其应用
- [Jianzhi offer] 64 Find 1+2+... +n
- C语言字符串反转
- 【剑指 Offer 】64. 求1+2+…+n
- Build your own website (23)
- What kind of material is 14Cr1MoR? Analysis of chemical composition and mechanical properties of 14Cr1MoR
猜你喜欢
What kind of material is 14Cr1MoR? Analysis of chemical composition and mechanical properties of 14Cr1MoR
智慧之道(知行合一)
Arduino esp32: overall framework of lvgl project (I)
ucore概述
Pytorch 1.12 was released, officially supporting Apple M1 chip GPU acceleration and repairing many bugs
[combinatorics] non descending path problem (number of non descending paths with constraints)
CC2530 common registers for ADC single channel conversion
What is the difference between 14Cr1MoR container plate and 14Cr1MoR (H)? Chemical composition and performance analysis of 14Cr1MoR
聊聊接口优化的几个方法
美团一面:为什么线程崩溃崩溃不会导致 JVM 崩溃
随机推荐
What material is sa537cl2 equivalent to in China? Sa537cl2 corresponding material
To resist 7-Zip, list "three sins"? Netizen: "is the third key?"
How to judge the region of an IP through C?
線程池:業務代碼最常用也最容易犯錯的組件
[combinatorial mathematics] recursive equation (example of recursive equation 2 Hanoi Tower | example of recursive equation 3 insertion sequencing)
How to promote cross department project collaboration | community essay solicitation
Daily code 300 lines learning notes day 10
图之深度优先搜索
MySQL converts comma separated attribute field data from column to row
C language modifies files by line
What material is 13crmo4-5 equivalent to in China? 13crmo4-5 chemical composition 13crmo4-5 mechanical properties
29:第三章:开发通行证服务:12:开发【获得用户账户信息,接口】;(使用VO类包装查到的数据,以符合接口对返回数据的要求)(在多处都会用到的逻辑,在Controller中可以把其抽成一个共用方法)
Thread pool: the most common and error prone component of business code
Hands on in-depth learning notes (XIV) 3.7 Simple implementation of softmax regression
What is the pledge pool and how to pledge?
Interpretation of several important concepts of satellite antenna
On Lagrange interpolation and its application
HP 阵列卡排障一例
网络安全web渗透技术
SSH连接远程主机等待时间过长的解决方法