创建新的仓库用于接收数据
svnadmin create /data/svn/new
设置新的同步
vim /data/svn/new/hooks/pre-revprop-change
exit 0
chmod u+x /data/svn/new/hooks/pre-revprop-change
svnsync init file:///data/svn/new/ https://svn.xxx.com/svn/old/ --username aa --password bb
svnsync sync file:///data/svn/new/
rsync同步归档
#!/bin/bash
remote_ipaddr="10.3.8.73"
ssh_cmd="ssh -p 9018 -o StrictHostKeyChecking=no -o PasswordAuthentication=no"
rsync_args="-aq --delete --progress --bwlimit=30000"
today=`date +"%Y-%m-%d %H:%M:%S"`
script_dir=/root/scripts
remote_dir=/home/repos/proj_rz
/usr/bin/rsync $rsync_args -e "$ssh_cmd" repos@${remote_ipaddr}:$remote_dir/ /data/rsync/xiaoxiami_repos/
if [ $? -eq 0 ];then
echo "$today rsync proj_rz success"
else
echo "$today rsync proj_rz failed"
if [ $(cat $script_dir/.lock/xiaoximi.lock) -lt 3 ];then
# Only send 3 times a day
curl https://jk.xxxxx.com/api/send -d "tos=xxxxx&content=$(date '+%Y-%m-%d %H:%M:%S')rsync xiaoxiami svn failed."
echo $(expr $(cat $script_dir/.lock/xiaoximi.lock) + 1) > $script_dir/.lock/xiaoximi.lock
else
echo "has send 3 wx alarm,so pass send"
fi
fi
if [ $(date "+%H") -eq 06 ];then
# every day reset lock
echo 0 > $script_dir/.lock/xiaoximi.lock
fi