0

I tried to do a post-commit to update my website at each commit. in the /hooks/post-commit

I did as follow

/svnUupdat/cProgrammeThatUpdate >> /log/test.log

Ok now if I try that

env - ./post-commit

it works, the website get update to the last revision (and there is something in the log)

but if I commit the post-commit is not called ?? (nothing in the log and the site is not updated)

Note that if I only put in the post-commit

/bin/echo "post-commit run" >> /log/test.log

If a commit something... it works.. there is something in the log.. Why is not calling my c programme then ?

EDIT I tried something else, that instead of calling a c programm

/usr/bin/svn update /var/www/vhost/xx.com/site1/ >> /var/log/svn/example.log

in the log I have Skipped /var/www...

Why is it skipped ? if i launch the svn update in a terminal it works the working directory get the last revision

thanks

Wim Coenen
  • 66,094
  • 13
  • 157
  • 251
Johny19
  • 5,364
  • 14
  • 61
  • 99

2 Answers2

2

BEWARE that when SVN calls the hook file, it does so as if no environment variables are set. You will therefore have to manually set the PATH variable at the beginning of your hook file.

TonySalimi
  • 8,257
  • 4
  • 33
  • 62
1

The 'skipped' message indicates that Subversion cannot update the directory because it's not a working copy. However, this conflicts with your statement that you could update the directory manually. Maybe there's a typo somewhere in your path?

You should also be aware that the post-commit script is executed as the user who is committing. This may or may not be the same user that you are when using the terminal. You should check if the commit user has proper priviledges to execute the post-commit script and if that user has permissions to do whatever your script does.

u-punkt
  • 4,744
  • 1
  • 16
  • 7
  • Hello, Indeed I had a typo in my path (in the post-commit). Now that the path is correct after A commit there is nothing in the log... So it is probably a problem of privilege. The proccess that is commiting is httpd and the owner of it is apache I already did chown apache.apache post-commit Do i have to do the same of my working directory ? – Johny19 Dec 06 '11 at 10:54
  • Since you plan to update your work directory, you'll most certainly need write permissions. Try to `su - apache` (or whatever your httpd user is) and execute your post-commit script. However, you should be aware of what you are doing when you changing permissions for the http daemon as this may have security implications. Have you considered using 'svn+ssh' to access your repo instead? – u-punkt Dec 06 '11 at 11:43