Nonsense not much to say, directly on the Post-commit script:
The logs are all recorded, including synchronized files.
Vim Post-commit
#!/bin/shRepos= "$"#the path to the warehouserev= "$"#newly submitted version numberExport Lc_all= "ZH_CN." UTF-8 "Expor LANG= "en_US." UTF-8 "LOGFILE=/var/Log/svn-hooks.Log #The log of the hook script#standard output and standard error output of the script are printed in the log fileexec1>> "$LOGFILE"exec2>&1SVN=/usr/bin/Svnsvnuser=luoxiaoguangsvnpwd=Lxg888webroot=/usr/local/nginx/Htmlsvnlook=/usr/bin/Svnlook Time=$(Date"+%y-%m-%d%h:%m:%s") AUTHOR=$($SVNLOOKAuthor-r$REV"$REPOS")#Submit Authorchangeddirs=$ ($SVNLOOKDirs-changed$REPOS)#Modified Catalog Collectionmessage=$ ($SVNLOOK Log-R$REV"$REPOS")#comment Information on submission, not recommended in ChinesefunctionMyecho () {Echo"$TIME" "$*"}myecho"**************************************************************"Myecho"Submit version:$REV $AUTHOR"Myecho"Submit notes:$MESSAGE"Myecho"Modify Directory: $ (echo$CHANGEDDIRS| Tr ' \ n ') "Masterdir=$(Echo"$CHANGEDDIRS" | HEAD-1)#the home directory in the Changeddirs#traverse the submitted code directory and synchronize to the Web server while[ "$CHANGEDDIRS" != "" ]; DoPROJECT=$(Echo $MASTERDIR| Awk-f/' {print $} ') Myecho"Current project:$PROJECT"#Judging the project folder if[ "$PROJECT"= =" Ipengbei "];then WEB=/usr/local/nginx/html/Ipengbei Myecho MyechoProject$PROJECTSynchronization directory:$MASTERDIR"MyechoThe Sync$MASTERDIRTo TYQ:$WEBROOT/ipengbei "$SVN--non-interactive Update$WEB--username Luoxiaoguang--Password lxg888chmod-R 755$WEBElif ["$PROJECT"= =" Ipengbeiweb "];then WEB=/usr/local/nginx/html/ipengbeiweb Myecho MyechoProject$PROJECTSynchronization directory:$MASTERDIR"MyechoThe Sync$MASTERDIRTo Ipbweb_dev:$WEBROOT/ipengbeiweb "$SVNUpdate--non-interactive$WEB--username Luoxiaoguang--Password lxg888chmod-R 755$WEB chmod-R 777$WEB/app/Runtimechmod-R 777$WEB/Webconfigchmod-R 777$WEB/UFElse:fi#Delete the synchronized directories in the directory collectionchangeddirs=$ (Echo"$CHANGEDDIRS" | Grep-v "^$MASTERDIR") #Get new home directories that need to be synchronizedmasterdir=$ (Echo"$CHANGEDDIRS" | Head-1) Done
SVN server hooks hooks can be used for multi-project auto-synchronization