当前位置:网站首页>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
边栏推荐
- How to allow remote connection to MySQL server on Linux system?
- The word backspace key cannot delete the selected text, so you can only press Delete
- NLP四范式:范式一:非神经网络时代的完全监督学习(特征工程);范式二:基于神经网络的完全监督学习(架构工程);范式三:预训练,精调范式(目标工程);范式四:预训练,提示,预测范式(Prompt工程)
- RedHat 6.2 配置 Zabbix
- Overview of satellite navigation system
- CC2530 common registers for timer 1
- utfwry. Dat PHP, about ThinkPHP's method of IP location using utfwry address Library
- PHP converts a one-dimensional array into a two-dimensional array
- 數據分析必備的能力
- 跨境电商:外贸企业做海外社媒营销的优势
猜你喜欢

What material is 12cr1movr? Chemical property analysis of pressure vessel steel plate 12cr1movr

ANOVA example

什么是质押池,如何进行质押呢?
The way of wisdom (unity of knowledge and action)

Aike AI frontier promotion (7.3)

Mysql database -dql

人生还在迷茫?也许这些订阅号里有你需要的答案!
![29: Chapter 3: develop Passport Service: 12: develop [obtain user account information, interface]; (use VO class to package the found data to meet the requirements of the interface for the returned da](/img/1c/c655c8232de1c56203873dcf171f45.png)
29: Chapter 3: develop Passport Service: 12: develop [obtain user account information, interface]; (use VO class to package the found data to meet the requirements of the interface for the returned da
![[combinatorics] polynomial theorem (polynomial theorem | polynomial theorem proof | polynomial theorem inference 1 item number is the number of non negative integer solutions | polynomial theorem infe](/img/9d/6118b699c0d90810638f9b08d4f80a.jpg)
[combinatorics] polynomial theorem (polynomial theorem | polynomial theorem proof | polynomial theorem inference 1 item number is the number of non negative integer solutions | polynomial theorem infe

静态程序分析(一)—— 大纲思维导图与内容介绍
随机推荐
PHP converts a one-dimensional array into a two-dimensional array
Deep understanding of grouping sets statements in SQL
What is the material of 13mnnimor? 13mnnimor steel plate for medium and low temperature pressure vessels
Capacités nécessaires à l'analyse des données
【剑指 Offer 】57 - II. 和为s的连续正数序列
Analysis of variance summary
Fast Ethernet and Gigabit Ethernet: what's the difference?
CC2530 common registers for watchdog
Summary of three methods of PHP looping through arrays list (), each (), and while
NLP四范式:范式一:非神经网络时代的完全监督学习(特征工程);范式二:基于神经网络的完全监督学习(架构工程);范式三:预训练,精调范式(目标工程);范式四:预训练,提示,预测范式(Prompt工程)
大消费企业怎样做数字化转型?
Necessary ability of data analysis
C language string inversion
在iptables防火墙下开启vsftpd的端口
One brush 144 force deduction hot question-1 sum of two numbers (E)
CC2530 common registers for timer 1
Web crawler knowledge day03
Daily code 300 lines learning notes day 10
C language modifies files by line
2022.02.14_ Daily question leetcode five hundred and forty