SVN automatically commits automatic synchronization to the server instead of SVN hooks

Source: Internet
Author: User
Tags svn update rsync

Principle:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/4E/wKioL1X6JHvCd7lVAACpWypSCVE312.jpg "title=" 2234. PNG "alt=" wkiol1x6jhvcd7lvaacpwypscve312.jpg "/>



1 first from the SVN vault update to the replica

2 again by copy if there is a change synchronized to the real test environment (here exclude some directories and files that do not need to be synchronized)

VI rsync.sh

#! /bin/bash

#author lrm929

#date 2015-09-17

Rsync () {

#定义rsync function

SVN update/www/web/fz_checkout >/dev/null

#svn副本更新, this update is to take the value of SVN log

aa=$ (svn log/www/web/fz_checkout/|grep r|sed-n ' 1p ' |awk ' {print $} ' |sed ' s/r//g ')

#取svn the latest log number

cc=$ (Cat/tmp/aa.txt)

The value of the #这个是定义一个比最新一条小

If [$aa-gt $CC]

#判断svn是否有更新, compare the latest log of the SVN log with the one before the update

Then

SVN update/www/web/fz_checkout

#svn副本更新 (This can actually be used)

RSYNC-AVRL--delete--exclude-from= "/root/exclude.list" */www/web/fz/

#更新副本到真实测试环境, exclude exclude.list directories and files

SVN log |grep r|sed-n ' 1p ' |awk ' {print $} ' |sed ' s/r//g ' >/tmp/aa.txt

The #取到本次更新的svn log value is stored in the/tmp/aa.txt file, which is compared for later updates

now=$ (date ' +%y-%m-%d%h:%m ')

echo "######### $NOW ############" >>/tmp/rsync.log

echo "Updat rsync ..... ..... ..... ..... ..... ..... ..... ..... ..... ..... ....... ........"

#将更新时间写到日志

Else

echo "1" >/dev/null

#如果没有更新就退出了

Fi

}


while [true]; Do

/bin/sleep 2

Rsync

Done

# then write a loop between sleep 2 seconds to execute this function



nohup/www/web/fz_checkout/rsync.sh >/tmp/rsync.log &

#最后将本脚步在后台执行


This article is from the "believe it or not you" blog, please be sure to keep this source http://312461613.blog.51cto.com/965442/1695600

SVN automatically commits automatic synchronization to the server instead of SVN hooks

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.