1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# cat /data0/svnbackup/backupsvn.sh
#!/bin/bash
########################################
# Filename:/data0/svnbackup/backupsvn.sh
#######################################
ntpdate us.pool.ntp.org
DATE=`
date
+
"%Y%m%d"
`
REPOS=
"showyw test"
REPOS_PATH=
/data0/svn
BACKUP_PATH=
/data0/svnbackup
LOGFILENAME=svnbackup.log
SVNADMIN=
/usr/local/svn/bin/svnadmin
ACCESSFILE=
/data0/svn/conf/authz
APACHECONG=
/usr/local/apache/conf/httpd
.conf
USERFILE=
/data0/svn/conf/
.htpasswd
DELDAY=`
date
-d
"2 days ago"
+
"%Y%m%d"
`
cd
${BACKUP_PATH}
mkdir
${DATE}
cd
${DATE}
touch
${LOGFILENAME}
echo
"SVN backup log"
>> ${LOGFILENAME}
echo
"mark: ${DATE}"
>> ${LOGFILENAME}
echo
""
>> ${LOGFILENAME}
date
+
"%Y-%m-%d %H:%M:%S backup SVN start"
>> ${LOGFILENAME}
for
repos
in
${REPOS}
do
echo
"backup ${repos} to `pwd`..."
echo
"backup ${repos}"
>> ${LOGFILENAME}
${SVNADMIN} hotcopy ${REPOS_PATH}/${repos} ${repos}
done
cp
-f ${ACCESSFILE} .
cp
-f ${APACHECONG} .
cp
-f ${USERFILE} .
#tar
cd
..
echo
"tar ......"
tar
-czf svn${DATE}.bak.
tar
.gz ${DATE}
rm
-rf ${DATE}
cp
-f svn${DATE}.bak.
tar
.gz
/datanfs/
rm
-rf svn
"${DELDAY}"
.bak.
tar
.gz
|
本文转自 wpf926 51CTO博客,原文链接:http://blog.51cto.com/wupengfei/1956863,如需转载请自行联系原作者