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