SVN uses hook post-commit to automatically update to the online test server

Source: Internet
Author: User
Tags svn update

To create a new version library:

[[email protected] svn]# pwd/home/svn[[email protected] svn]# svnadmin Create webtest[[email  Protected] svn]# Tree webtest/webtest/├──conf│  ├──authz│  ├──passwd│  └── svnserve.conf├──db│  ├──current│  ├──format│  ├──fsfs.conf│  ├── Fs-type│  ├──min-unpacked-rev│  ├──rep-cache.db│  ├──revprops│  │   └──0│  │  └──0│  ├──revs│  │  └──0│ &nbsp ; │  └──0│  ├──transactions│  ├──txn-current│  ├──txn-current-lock│&nbsp ;  ├──txn-protorevs│  ├──uuid│  └──write-lock├──format├──hooks│  ├── post-commit.tmpl│  ├──post-lock.tmpl│  ├──post-revprop-change.tmpl│  ├── Post-unlock.tmpl│  ├──pre-commit.tmpl│  ├──pre-lock.tmpl│ &nbSp ├──pre-revprop-change.tmpl│  ├──pre-unlock.tmpl│  └──start-commit.tmpl├──locks│   ├──db.lock│  └──db-logs.lock└──readme.txt10 directories, the files

Build a working copy again:

[[email protected] www]# pwd/alidata/www[[email protected] www]# mkdir webtest[[email protected] www]# #授权: Otherwise the submission will report permission Error! [Email protected] www]# Chmod-r 777 webtest/

With permissions:

[Email protected] conf]# VI svnserve.conf
[general]### These options control access to the repository for unauthenticated### and authenticated users. Valid values are "write", "read", # # # and "None". The sample settings below is the defaults.anon-access = readauth-access = Writepassword-db =/HOME/SVN/WEBTEST/CONF/PASSW Dauthz-db =/home/svn/webtest/conf/authz

[Users]
# Harry = Harryssecret
# sally = Sallyssecret
Svnadmin = 123456
Test = 123456

[Groups]
# harry_and_sally = harry,sally
# Harry_sally_and_joe = Harry,sally,&joe
admin = svnadmin
user = Test
[/]
@admin = RW
[/webtest]
@admin = RW
* =
# [Repository:/baz/fuz]
# @harry_and_sally = RW
# * = R

[Email protected] webtest]# Ps-ef |grep SVN
Root 2586 1 0 13:33? 00:00:00 svnserve-d-r/home/svn/webtest/
Root 2590 2475 0 13:33 pts/0 00:00:00 grep svn

After entering the directory, checkout a copy to synchronize the path of the on-line server:

[[Email protected] www]# SVN co svn://192.168.1.72/webtestsvn:url ' svn://192.168.1.72/webtest ' doesn ' t exist

[Email protected] www]# ls/home/svn/test  webtest #有两个版本库启动的时候应该是: svnserve-d-r/home/svn/

[Email protected] www]# ps-ef|grep svnroot      2650     1  0        00:00:00 svnserve-d-r/home/svn/root      2678  2475  0 14:04 pts/0    00:00:00 grep svn

[[Email protected] www]# SVN co svn://192.168.1.72/webtestchecked out revision 0. [Email protected] www]# lsphpwind  sx  webtest  xxzz

With Web:

I'm here to open an nginx vhost.

[Email protected] vhosts]# VI webtest.conf
server {
Listen 83;
server_name localhost;
Index index.html index.htm index.php;
Root/alidata/www/webtest;
Location ~. *\. (PHP|PHP5)? $
{
#fastcgi_pass Unix:/tmp/php-cgi.sock;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Include fastcgi.conf;
}
Location ~. *\. (gif|jpg|jpeg|png|bmp|swf) $
{
Expires 30d;
}
Location ~. *\. (JS|CSS)? $
{
Expires 1h;
}

include/alidata/server/nginx/conf/rewrite/default.conf;
Access_log/alidata/log/nginx/access/webtest.log;
}

[Email protected] vhosts]# service Nginx reloadreloading nginx!

[email protected] hooks]# CP Post-commit.tmpl Post-commit
[email protected] hooks]# which SVN
/usr/bin/svn

[[Email protected] hooks]# VI post-commit[[email protected] hooks]# pwd/home/svn/webtest/hooksrepos= "$" rev= "$" svn=/ usr/bin/svnweb=/alidata/www/webtestrsync=/usr/bin/rsynclog=/tmp/rsync_web.logwebip=192.168.1.73# This is the online Web server Ipexport lang=en_us.  UTF-8$SVN update $WEB--username svnadmin--password 123456if [$? = = 0]echo "" >> $LOGecho ' date ' >> $LOGecho "#####################" >> $LOG $rsync-vaztph--timeout=90--exclude-from=/home/svn/webtest/exclude.list $web [ Email protected] $WEBIP:/www/>> $LOGif #--exclude-from do not need to be excluded from synchronization
[Email protected] hooks]# chmod +x post-commit

http://darkyin.blog.51cto.com/6260426/1361132

SVN uses hook post-commit to automatically update to the online test server

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.