How the SVN server automatically updates files to the Web directory under Linux _linux

Source: Internet
Author: User
Tags auth svn svn client svn update

Description

Server operating system: CentOS
Server ip:192.168.21.134
SVN installation path:/USR/LOCAL/SVN
SVN project path:/HOME/SVN
SVN login account: Osyunwei
SVN login Password: 123456
Web site root directory:/home/web
to achieve the purpose:

When any updates are modified in the SVN project, the system automatically checks out the files from SVN and synchronizes to the Web site root directory

Specific actions:

First, use SVN post-commit implementation to automatically check out the files from SVN and sync to the Web site root directory

Cd/home/svn/hooks
VI post-commit #编辑, add the following code

#!/bin/sh
repos= "$"
rev= "$"
svn_path=/usr/local/svn/bin
web_path=/home/web
svn_user= Osyunwei
svn_pass=123456
web_user=www
log_path=/tmp/svn.log
echo ' date ' +%y-%m-%d%h:%m:%s ' >> $LOG _path
echo ' WhoAmI ', $REPOS, $REV >> $LOG _path
$SVN _path/svn update $WEB _path--username $ Svn_user--password $SVN _pass--no-auth-cache >> $LOG _path chown
$WEB _user. $WEB _user-r $WEB _path

: wq! #保存退出
Chown www:www/home/svn/hooks/post-commit #设置脚本所属用户组, www run accounts and groups for Web services
chmod +x/home/svn/hooks/post-commit #添加脚本执行权限
Description
WhoAmI #执行此程序的用户
Repos= "$" #svn项目绝对路径值
rev= "$" #最新版本号
--no-auth-cache #不保存账户认证信息

Second, the client testing

After you use the SVN client to add a file, the Web page is displayed in real time! As shown in the following illustration:

At this point, the SVN server under Linux automatically updates files to the Web directory tutorial complete.

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.