[[email protected]shell]# Cat Repolist Dev-arc
Dev-bm
Dev-crm
Dev-pay
dev-pm
Dev-portal
Dev-risk
hr
Product
Qa
rep-ops[[email protected]shell]# Cat svnbackup.sh #!/bin/bash
rm-rf/yc/backup/dump/* &>/dev/null
rm-rf/yc/backup/hotcopy/* &>/dev/null
date=$ (Date +%y%m%d)
###################### #dump backup###############################
For i in ' cat/shell/repolist '
Do
/yc/usr/local/subversion/bin/svnadmin dump/yc/svn/$i >/yc/backup/dump/$i-$DATE. dump.gz
Done
If [$?-eq 0];then
echo "$DATE/yc/usr/local/subversion/bin/svnadmin dump full backup successful." >>/var/log/svnbackup.log
Else
echo "$DATE/yc/usr/local/subversion/bin/svnadmin dump full backup failed." >>/var/log/svnbackup.log
Fi
Ssh[email protected]"Mkdir/yc/svn/backup/dump/$DATE"
Scp-r/yc/backup/dump/*[email protected]:/yc/svn/backup/dump/$DATE &>/dev/null
If [$?-eq 0];then
echo "$DATE Transfer svn dump Backup to 10.11.100.205 successful." >>/var/log/svnbackup.log
Else
echo "$DATE Transfer svn dump Backup to 10.11.100.205 failed." >>/var/log/svnbackup.log
Fi
###################### #hotcopy backup###############################
For i in ' cat/shell/repolist '
Do
/yc/usr/local/subversion/bin/svnadmin hotcopy/yc/svn/$i/yc/backup/hotcopy/$i
Done
If [$?-eq 0];then
echo "$DATE/yc/usr/local/subversion/bin/svnadmin hotcopy Full backup successful." >>/var/log/svnbackup.log
Else
echo "$DATE/yc/usr/local/subversion/bin/svnadmin hotcopy Full backup failed" >>/var/log/svnbackup.log
Fi
Ssh[email protected]"Mkdir/yc/svn/backup/hotcopy/$DATE"
Scp-r/yc/backup/hotcopy/*[email protected]:/yc/svn/backup/hotcopy/$DATE/&>/dev/null
If [$?-eq 0];then
echo "$DATE Transfer svn hotcopy Backup to 10.11.100.205 successful." >>/var/log/svnbackup.log
Else
echo "$DATE Transfer svn hotcopy Backup to 10.11.100.205 failed." >>/var/log/svnbackup.log
Fi Note: **subversion use the absolute path because the source package is used for installation. **
SVN uses dump and hotcopy for script backup