Svnadmin hotcopy can be used for full backup, but incremental backup is not supported. Svnadmin hotcopy copies the entire database in "hot" mode, including the hook script and configuration file of the database. Running this script at any time generates a secure copy of the version Library, whether or not other processes are using the version Library.
The advantage is that the backup process is fast and disaster recovery is fast. If the svn service has been set up on the backup machine and you do not need to recover it, you only need to perform simple configuration to switch to the backup database.
Disadvantage: it is hard disk-consuming and requires large hard disk support.
Backup command:
Svnadmin hotcopy/path/to/repository/path/to/backup
1) define backup policies
Backup frequency: perform a full backup every day.
Backup location: the backup directory is named after the current time. The backup path is/data/svnbackup /.
Backup retention period: If the backup is retained for 7 days and deleted for more than 7 days.
Backup Time: Starts at every night.
Backup check: after the backup is completed, the system automatically checks whether the backup is correct and records logs.
2) create a backup script
Create the backup script svnbak. sh in the/data/shells Directory. If the svn repository path is/data/svn, back up it to/data/svnbackup /:
#! /Bin/bash # Filename: svnbak. sh # Revision: 1.0 # Date: 2014/11/07 # Author: Qicheng # Email: # Website: # Description: SVN full backup # Notes: add the script to crontab, daily scheduled execution # MAXDAYS = 7 # maximum number of days for backup retention TIME = 'date + '% Y % m % d % H % M % s' SVNPATH =/data/svn # Definition repository repos path BAKDIR =/data/svnbackup # defines the backup home directory BAKSUBDIR =$ {BAKDIR}/$ {TIME} # defines the full backup path BAKLOG =$ {BAKDIR}/$ {TIME }. log # define backup log [! -F "$ {BAKSUBDIR}"] & mkdir-p $ {BAKSUBDIR} exec 1 >1 {BAKLOG} exec 2> & 1 set-x # delete historical backup find $ {BAKDIR}-maxdepth 1-type f-mtime + $ (expr $ {MAXDAYS}-1) -exec echo "Delete {}" \;-exec rm "{}"\; # full backup svnadmin hotcopy $ {SVNPATH }$ {BAKSUBDIR} # if the version number is printed, the backup is correct. svnlook youngest $ {BAKSUBDIR} [$? -Ne 0] & exit 1cd $ {BAKDIR} # compress the backup tar cvzf 1_1_time1_.tar.gz $ {TIME}/rm-rf $ {BAKSUBDIR} # you can use rsync to synchronize the backup file to a remote device. backup machine, this is omitted.
Test:
650) this. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/4D/E9/wKiom1RcWNGQ2Q3fAAIDOx8Gp0M614.jpg "title =" QQ20141107132900.png "alt =" wKiom1RcWNGQ2Q3fAAIDOx8Gp0M614.jpg "/>
3) set the timed crontab
Execute the script at every day:
59 23 ***/bin/bash/data/shells/svnbak. sh
References:
Http://www.cnblogs.com/itech/archive/2011/10/11/2206988.html
This article is from the "departure-Linux technology blog" blog, please be sure to keep this source http://qicheng0211.blog.51cto.com/3958621/1573989
SVN full backup svnadmin hotcopy