svn利用钩子post-commit自动更新到线上测试服务器(测试中未验证)
创建一个新的版本库:
[root@centos03 svn]# pwd
/home/svn
[root@centos03 svn]# svnadmin create webtest
[root@centos03 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
│ │ └── 0
│ ├── transactions
│ ├── txn-current
│ ├── txn-current-lock
│ ├── 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
│ ├── pre-revprop-change.tmpl
│ ├── pre-unlock.tmpl
│ └── start-commit.tmpl
├── locks
│ ├── db.lock
│ └── db-logs.lock
└── README.txt 10 directories, 28 files
再建一个工作副本:
[root@centos03 www]# pwd
/alidata/www
[root@centos03 www]# mkdir webtest
[root@centos03 www]# #授权:否则提交会报权限错误!
[root@centos03 www]# chmod -R 777 webtest/
配权限:
[root@centos03 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 are the defaults.
anon-access = read
auth-access = write
password-db = /home/svn/webtest/conf/passwd
authz-db = /home/svn/webtest/conf/authz
[root@centos03 conf]# vi passwd
[users]
# harry = harryssecret
# sally = sallyssecret
svnadmin = 123456
test = 123456
[root@centos03 webtest]# vi /home/svn/webtest/conf/authz
[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
[root@centos03 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
进入该目录后,checkout出一个副本,用于同步上线上服务器的路径:
[root@centos03 www]# svn co svn://192.168.1.72/webtest
svn: URL 'svn://192.168.1.72/webtest' doesn't exist
[root@centos03 www]# ls /home/svn/
test webtest #有两个版本库启动的时候应该是:svnserve -d -r /home/svn/
[root@centos03 www]# ps -ef|grep svn
root 2650 1 0 14:00 ? 00:00:00 svnserve -d -r /home/svn/
root 2678 2475 0 14:04 pts/0 00:00:00 grep svn
[root@centos03 www]# svn co svn://192.168.1.72/webtest
Checked out revision 0.
[root@centos03 www]# ls
phpwind sx webtest xxzz
配WEB:
我这里是开一个nginx vhost
[root@centos03 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;
}
[root@centos03 vhosts]# service nginx reload
Reloading nginx!
[root@centos03 hooks]# cp post-commit.tmpl post-commit
[root@centos03 hooks]# which svn
/usr/bin/svn
[root@centos03 hooks]# vi post-commit
[root@centos03 hooks]# pwd
/home/svn/webtest/hooks
REPOS="$1"
REV="$2"
SVN=/usr/bin/svn
WEB=/alidata/www/webtest
RSYNC=/usr/bin/rsync
LOG=/tmp/rsync_web.log
WEBIP=192.168.1.73
#这是线上web服务器IP
export LANG=en_US.UTF-8
$SVN update $WEB --username svnadmin --password 123456
if [ $? == 0 ]
echo "" >>$LOG
echo `date` >> $LOG
echo "#####################" >>$LOG
$RSYNC -vaztpH --timeout=90 --exclude-from=/home/svn/webtest/exclude.list $web root@$WEBIP:/www/>>$LOG
if
#--exclude-from 可不要根据需求不同步的排除
[root@centos03 hooks]# chmod +x post-commit
http://darkyin.blog.51cto.com/6260426/1361132
svn利用钩子post-commit自动更新到线上测试服务器(测试中未验证)的更多相关文章
- 分享下使用 svn,测试服务器代码自动更新、线上服务器代码手动更新的配置经验
分享下使用 svn,测试服务器代码自动更新.线上服务器代码手动更新的配置经验 利用SVN的POST-COMMIT钩子自动部署代码 Linux SVN 命令详解 Linux SVN 命令详解2 使用sv ...
- 使用 SVN Hook 实现服务器端代码自动更新
之前的做法是客户端提交代码之后,再去服务器端项目中 svn up 一下来更新代码,让服务器端的项目更新到最新版本.可以编写一个 post-commit 钩子脚本来实现服务器端代码的自动更新,它在 SV ...
- git 利用hook 实现服务器自动更新代码
如何利用git的hook实现提交代码后自动更新? 因为个人开发经常需要提交代码,每次都需要连接服务器去pull代码,重启服务器就显得十分繁琐,因此github提供了一个时间钩子,用户push代码后可以 ...
- svn利用钩子脚本功能实现代码同步到web目录
一.hook简单介绍 为了方便管理员控制提交的过程 ,Subversion提供了hook机制.当特定的 事件发生时,相应的 hook会被调用,hook其实就相当于特定事件的处理函数.每个hook会得到 ...
- svn利用钩子实现代码同步到web目录
思路: 找 到SVN Server中的仓库(Repositories)文件夹的位置,在相应的项目文件夹中找到hooks文件夹.在该文件夹中添加一个post- commit文件:当有commit动作发 ...
- windows svn利用钩子实现代码同步到web目录
思路: 找 到SVN Server中的仓库(Repositories)文件夹的位置,在相应的项目文件夹中找到hooks文件夹.在该文件夹中添加一个post- commit文件:当有commit动作发 ...
- python学习笔记(Tkinter编程利用Treeview实现表格自动更新)
博主今天总结这段时间抽空写的一个GUI编程项目 功能是查看本地打印机队列,可选择指定队列重新打印 直接上图 UI设计包括3个区域左上方,右上方和下方列表区域 使用网格grid方法来分配位置 下面是界面 ...
- 不停机不更新代码线上调试BUG的工具
如果你有以下痛点,请你查看本文章: 1.我改的代码为什么没有执行到?难道是我没 commit?分支搞错了? 2.遇到问题无法在线上 debug,难道只能通过加日志再重新发布吗? 3.线上遇到某个用户的 ...
- SVN跨服务器自动更新--实现文件分发
目标:SVN版本库提交,服务器中的工作拷贝能自动update. 实现方法:subversion, curl,php脚本实现,并且入mysql库来进行管理.改hosts文件来进行访问!提交触发钩子脚本时 ...
随机推荐
- Redis操作+python
自动化接口测试中需要向redis中插入测试数据: 1. 连接redis: import redisself.r = redis.StrictRedis(host=env.REDIS_HOST, por ...
- ci中如何得到配置的url
$this->load->helper('url'); 然后,你可以用它查询并返回设置在config.php文件中的site和/或base URL: echo site_url(); ec ...
- mysql 查看 删除 日志操作总结(包括单独和主从mysql)
我们可以在mysql的安装目录下看到mysql的二进制日志文件,如mysql-bin.000***等,很多人都不及时的处理,导致整个硬盘被塞满也是有可能的.这些是数据库的操作日志.它记录了我们平时使用 ...
- 微信JS-SDK
<div class="lbox_close wxapi_form"> <h3 id="menu-basic">基础接口</h3& ...
- python闭包小例子
------------------ 首先根据实例, 体会一下闭包的效果 ------------------ 定义闭包: def foo(x): a = [0] def bar(y): a[0] = ...
- javascript判断上传文件大小
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- Fortran向C传递NULL值
在很多C或C++的头文件定义中,NULL被指定定义为0,这里不再具体展开 gfortran的手册关于iso c binding的章节,定义NULL如下 Moreover, the following ...
- Tenth scrum meeting - 2015/11/4
我们的项目开发已经渐渐进入了后期,每个模块都只剩下了一小块任务待做,同学们在做自己的模块的同时也开始对各个同学的模块进行合并. 其中最麻烦的就是视频播放模块与其他模块的合并了,由于该模块的实现需要添加 ...
- FineUI第五天---按钮控件
按钮控件 <x:Button runat="server" ID="按下" Text="按下"></x:Button> ...
- 第20章 使用LNMP架构部署动态网站环境
章节概述: 本章节将从Linux系统的软件安装方式讲起,带领读者分辨RPM软件包与源码安装的区别.并能够理解它们的优缺点. Nginx是一款相当优秀的用于部署动态网站的服务程序,Nginx具有不错的稳 ...