Lưu ý: Phân này chỉ thực hiện được khi SVN và website cùng 1 server
Tạo một chương trình C với tên là post-commit.c và build với gcc trong linux
#include <stddef.h>
#include <stdlib.h>
#include <unistd.h>
int main(void)
{
while(1==1){
execl("/usr/bin/svn", "svn", "update", "/path/to/website/working/","--username","svnusername","--password","svnpassword",
(const char *) NULL);
return(EXIT_FAILURE);
}
}
Build chương trình trên với GCC
gcc -o post-commit post-commit.c
Phân quyền thực thi cho file vừa mới build ra
chmod 4755 post-commit
Coppy và dán file thực thi đó vào thư mục hooks của svn repository của bạn trên server
mv post-commit /foo/bar/hooks/
Lưu ý /foo/bả/hooks này là trên server mình đặt như vậy. Trên server của bạn sẻ đặt khác
Sửa lại tính năng store-password trong file /root/.subversion/servers
store-passwords = no
Sau đó nhớ phân quyền lại thư mục hooks 4775 để có thể thực thi đươc
Chúc các bạn thành công