#!/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
root@10.11.100.205 "mkdir /yc/svn/backup/dump/$DATE"
scp -r /yc/backup/dump/*
root@10.11.100.205:/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
root@10.11.100.205 "mkdir /yc/svn/backup/hotcopy/$DATE"
scp -r /yc/backup/hotcopy/*
root@10.11.100.205:/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