Automatically back up SVN repository using shell

Source: Internet
Author: User

This script is used to automatically back up version libraries under the svn directory and traverse the libraries through awk. The advantage of this is that when someone adds a new version library, there is no need to change the code, the program will automatically recognize it.
The following program provides a comprehensive backup script

#! /Bin/sh
# Version 1.0
# Updated 2008.9.2
Svn_root = "/home/svnroot"
Svn_backup = "/home/svnbackup"
Svn_backup_server = "root @ linux36:/home/svnbackup"
CD $ svn_root
Echo "$ PWD"
Svnadmin = "$ (which svnadmin )"
Svnlook = "$ (which svnlook )"
Mydate = "$ (date + % Y % m % d )"
Tar = "$ (which TAR )"
MV = "$ (which mV )"
Rm = "$ (which RM )"
Scp = "$ (which SCP )"
For svn_repos in 'LS-L $ svn_root | awk '{print $9 }''
Do
Svn_repos_version = '$ svnlook youngest $ svn_repos'
Echo $ svn_repos_version> $ svn_backup/log/"$ svn_repos" _ version
$ SCP $ svn_backup/log/"$ svn_repos" _ version $ svn_backup_server/log/

Echo "start full backup $ svn_repos"
$ Svnadmin dump $ svn_repos> $ svn_repos $ mydate. Dump
$ Tar czvf 1_svn_repos=mydate.dump.tar.gz $ svn_repos $ mydate. Dump

$ SCP synchronized svn_repos=mydate.dump.tar.gz $ svn_backup_server
$ MV upload svn_repos=mydate.dump.tar.gz $ svn_backup
$ Rm-F $ svn_repos $ mydate. Dump
Echo "Full backup $ svn_repos succeed! "
Done

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.