1. 程式人生 > >svn采用hooks鉤子自動同步代碼

svn采用hooks鉤子自動同步代碼

目錄 all $2 hooks code user ron -- 授權

在Apache初次拉取svn代碼到根目錄
比如:運行後再輸入用戶密碼
svn co svn://10.0.1.120/work/ --username jiangsq
在倉庫hooks/post-commit編輯如下參數(如果沒有復制模塊即可)
#!/bin/sh
REPOS="$1"
REV="$2"
export LC_ALL="zh_CN.UTF-8"
export LANG="en_US.UTF-8"
SVN_PATH=/usr/bin
WEB_PATH=/var/www/html/work
SVN_USER=jsuser
SVN_PASS=123456780
LOG_PATH=/tmp/svnsm.log
echo date "+%Y-%m-%d %H:%M:%S" >> $LOG_PATH
echo whoami,$REPOS,$REV >> $LOG_PATH
echo Download_username:$SVN_USER >> $LOG_PATH
$SVN_PATH/svn update $WEB_PATH --username $SVN_USER --password $SVN_PASS --no-auth-cache >> $LOG_PATH

授權:
#chown +x post-commit //即可

註意:前提需要在根目錄拉去一次svn代碼

svn采用hooks鉤子自動同步代碼