Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm using subversion together with Apache. I have my repo, owned by apache user and everything is running well, except post-commit hook. Whatever I have tested, code within post-commit script is not executed.

currently I'm trying to just echo something to the log:

/bin/echo `/usr/bin/date` >> /var/tmp/svnhook.log 2>&1

I can run this script under the apache user with removed PATH variable. For sure, script is owned by apache user and has execute rights. There is nothing relevant in apache logs.

Unfortunately commit is not triggering this echo.

I spent hours to investigate the issue, but I'm completely out of any ideas.

System is Fedora 18.

Edit: post-commit file

#pwd
/var/httpd/svn/delux/hooks
#ll post-commit
-rwxr-xr-x 1 apache apache 2151 jún  2 17:09 post-commit

Any hints are really appreciated, thank you.

share|improve this question
add comment

1 Answer

Check that apache has permissions on /var/tmp/svnhook.log as well. If the file doesn't already exist, make sure apache has write permissions on /var/tmp itself (creating the file can help too).

It can also be helpful to put a shebang at the top of the script to ensure the right shell executes it:

#!/bin/bash

Also make sure that the filename of the script is something like /var/svn/repos/reponame/hooks/post-commit. If the filename is other than post-commit, or it's not in the hooks directory, it will not be found.

share|improve this answer
    
Hi, thanks for hints, but I have tested the script under apache user and it's running as expected. This seems to me like issue with post-commit triggering. Currently file is in the hooks with correct name, I hope :) –  Ivan Jun 2 '13 at 21:29
    
You'd have to try it with the apache user's shell and environment too, which is usually weird (like /bin/false). –  Falcon Momot Jun 3 '13 at 5:37
    
Yep, I have change it to /bin/bash to give a try, but results are as are.. manually all is running, but not by commit :) –  Ivan Jun 3 '13 at 8:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.