zoukankan      html  css  js  c++  java
  • SVN 钩子操作-同步更新web目录

    一个简单的钩子演示:也可以网上搜索其他高级的

    本次想要达到的功能是:每次用户commit 到仓库后,仓库的钩子会自动把程序又更新的www/的web发布目录

    1.现在web目录下创建一个test.com网站目录

    [root@wentao13 ~]# cd /var/www/html/
    [root@wentao13 html]# svn checkout svn://localhost/test.com
    Authentication realm: <svn://localhost:3690> 59865037-2557-40be-aa97-d460f66b4c60
    Password for 'root': 
    Authentication realm: <svn://localhost:3690> 59865037-2557-40be-aa97-d460f66b4c60
    Username: wentao
    Password for 'wentao': 
    
    -----------------------------------------------------------------------
    ATTENTION!  Your password for authentication realm:
    
       <svn://localhost:3690> 59865037-2557-40be-aa97-d460f66b4c60
    
    can only be stored to disk unencrypted!  You are advised to configure
    your system so that Subversion can store passwords encrypted, if
    possible.  See the documentation for details.
    
    You can avoid future appearances of this warning by setting the value
    of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
    '/root/.subversion/servers'.
    -----------------------------------------------------------------------
    Store password unencrypted (yes/no)? y
    A    test.com/2.txt
    A    test.com/3.txt
    A    test.com/test.php
    A    test.com/1.php
    Checked out revision 8.
    [root@wentao13 html]# 

    按照提示需要输入root 密码,和svn授权用户名和密码

    然后配置hook文件夹的脚本

    [root@wentao13 hooks]# pwd
    /root/svnRepo/test.com/hooks
    [root@wentao13 hooks]# ll
    total 36
    -rw-r--r--. 1 root root 1977 Mar 29 08:59 post-commit.tmpl
    -rw-r--r--. 1 root root 1638 Mar 29 08:59 post-lock.tmpl
    -rw-r--r--. 1 root root 2289 Mar 29 08:59 post-revprop-change.tmpl
    -rw-r--r--. 1 root root 1567 Mar 29 08:59 post-unlock.tmpl
    -rw-r--r--. 1 root root 3426 Mar 29 08:59 pre-commit.tmpl
    -rw-r--r--. 1 root root 2434 Mar 29 08:59 pre-lock.tmpl
    -rw-r--r--. 1 root root 2786 Mar 29 08:59 pre-revprop-change.tmpl
    -rw-r--r--. 1 root root 2122 Mar 29 08:59 pre-unlock.tmpl
    -rw-r--r--. 1 root root 2780 Mar 29 08:59 start-commit.tmpl
    [root@wentao13 hooks]# 

    把下面的钩子文件模板改成可执行文件

    [root@wentao13 hooks]# cp post-commit.tmpl post-commit
    [root@wentao13 hooks]# chmod +x post-commit
    [root@wentao13 hooks]# 

     vim post-commit   添加下面内容:

    export LANG=en_US.UTF-8
    /usr/bin/svn update /var/www/html/test.com --username wentao --password 123456

     网站发布目录同步更新

  • 相关阅读:
    寒假day08
    操作系统(一)操作系统的目标和作用
    数据结构排序算法稳定性总结——写给自己看
    网络请求生命周期
    PHP 不同类型之间的松散和严格比较
    php配置可被设定范围
    laravel5.7 前后端分离开发 实现基于API请求的token认证
    laravel 自动加载 自定义的文件/辅助函数
    laravel5.7 migrate 时报错 Specified key was too long error 解决方案
    PHP 命名空间
  • 原文地址:https://www.cnblogs.com/fps2tao/p/8673258.html
Copyright © 2011-2022 走看看