這里只考慮apache http服務(wù)器和svn的集成
post-commit腳本
your_repo_path/hooks/post-commit.tmpl復(fù)制一份為post-commit,加可執(zhí)行權(quán)限,用戶和組為apache:
chmod +x post-commit chown apache:apache post-commit
由于post-commit腳本是apache用戶執(zhí)行的,如果線上代碼被root執(zhí)行過svn update,就會使.svn目錄的用戶權(quán)限和用戶組權(quán)限變掉,導(dǎo)致post-commit無法正確執(zhí)行(可以通過post-commit腳本中打印日志查看),因此對于用ftp上傳到線上、用戶手動上傳資源的情況,暫時編寫了一個腳本,用于從線上commit并把權(quán)限改回來:
util_commit:
#!/bin/bash svn cleanup svn commit chown -R apache:apache .
我的post-commit腳本也可以作為參考:

image.png
記得把上面username和password替換掉