如何借助 svn update 自动更新线上的web

    1.进入到你创建的版本库目录下面,目录结构大致如下

drwxr-xr-x 2 root root 4096 Mar 16 00:18 conf
drwxr-sr-x 6 root root 4096 Apr 12 15:11 db
-r--r--r-- 1 root root    2 Mar 16 00:12 format
drwxr-xr-x 2 root root 4096 Mar 23 17:30 hooks
drwxr-xr-x 2 root root 4096 Mar 16 00:12 locks
-rw-r--r-- 1 root root  229 Mar 16 00:12 README.txt

    2. 进入 hooks 目录下,这里就是我们能够使用的所有钩子。要实现我的需求,只需要 post-commit.tmpl 这一个,也就是使用 svn 客户端成功提交到仓库之后要执行的操作

[root@xxxxxx hooks]# ls -l
total 40
-rw-r--r-- 1 root root 1977 Mar 22 17:15 post-commit.tmpl
-rw-r--r-- 1 root root 1638 Mar 16 00:12 post-lock.tmpl
-rw-r--r-- 1 root root 2289 Mar 16 00:12 post-revprop-change.tmpl
-rw-r--r-- 1 root root 1567 Mar 16 00:12 post-unlock.tmpl
-rw-r--r-- 1 root root 3432 Mar 16 00:12 pre-commit.tmpl
-rw-r--r-- 1 root root 2416 Mar 16 00:12 pre-lock.tmpl
-rw-r--r-- 1 root root 2786 Mar 16 00:12 pre-revprop-change.tmpl
-rw-r--r-- 1 root root 2106 Mar 16 00:12 pre-unlock.tmpl
-rw-r--r-- 1 root root 2780 Mar 16 00:12 start-commit.tmpl

    3.之后如下操作

[root@xxxxxx hooks]# cp post-commit.tmpl post-commit
[root@xxxxxx hooks]# vim post-commit

    4.定位到文件底部(G),去除自带的使用示例,根据个人需求,追加如下内容 保存退出

SVN=/usr/local/bin/svn
WEB=/www/demo.xxx.net/

export.UTF-8
$SVN update $WEB --username xxoo--password xxoo
chown -Rf www:www $WEB
chmod -Rf 755 $WEB

    5.最后赋予 post-commit 可执行权限

[root@xxxxxx hooks]# chmod u+x post-commit


转载于:https://my.oschina.net/antsky/blog/657537

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值