当前位置:网站首页>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 is the maximum number of concurrent TCP connections for a server? 65535?
- RedHat 6.2 配置 Zabbix
- arduino-esp32:LVGL项目(一)整体框架
- 建立自己的网站(23)
- Idea configuration plug-in
- [combinatorics] recursive equation (characteristic equation and characteristic root | example of characteristic equation | root formula of monadic quadratic equation)
- Define a structure fraction to represent a fraction, which is used to represent fractions such as 2/3 and 5/6
- 比亚迪、长城混动市场再“聚首”
- ANOVA example
- 跨境电商:外贸企业做海外社媒营销的优势
猜你喜欢

Analysis of variance summary

UCORE overview

The largest matrix (H) in a brush 143 monotone stack 84 histogram

What is the pledge pool and how to pledge?

ucore概述

C language modifies files by line

Build your own website (23)

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

Daily code 300 lines learning notes day 10

Arduino esp32: overall framework of lvgl project (I)
随机推荐
數據分析必備的能力
word 退格键删除不了选中文本,只能按delete
[combinatorics] polynomial theorem (polynomial coefficients | full arrangement of multiple sets | number of schemes corresponding to the ball sub model | polynomial coefficient correlation identity)
2022.02.14_ Daily question leetcode five hundred and forty
Kotlin学习快速入门(7)——扩展的妙用
比亚迪、长城混动市场再“聚首”
智慧之道(知行合一)
Squid 服务启动脚本
Kindeditor editor upload image ultra wide automatic compression -php code
How to allow remote connection to MySQL server on Linux system?
What is the maximum number of concurrent TCP connections for a server? 65535?
建立自己的网站(23)
27. 输入3个整数,按从大到小的次序输出。要求用指针方法实现。
Summary of three methods of PHP looping through arrays list (), each (), and while
What kind of material is 14Cr1MoR? Analysis of chemical composition and mechanical properties of 14Cr1MoR
CC2530 common registers for port interrupts
What material is 12cr1movr? Chemical property analysis of pressure vessel steel plate 12cr1movr
PHP converts a one-dimensional array into a two-dimensional array
JSON 与 BSON 区别
CC2530 common registers for port initialization