문제

I have a SVN repo served by Apache over DAV.

I've created a post-commit hook that I want to open a telnet session to a server.

When I execute the commands from the command prompt, it works fine.

But when I execute it with the hook, it fails, saying that it doesn't have permissions to execute.

My script is simple:

 #!/bin/sh
 REPOS="$1"
 REV="$2"

 echo -e symeon\\nfrobnitz\\n.say \#foo easitag $REV $(svnlook author $REPOS -r $REV)    $(svnlook changed $REPOS -r $REV): $(svnlook log $REPOS -r $REV) | telnet server 8080

The hook is running on a RedHat Enterprise Linux machine. I'm assuming it's executing as the apache user.

Anyone know why?

도움이 되었습니까?

해결책 2

I found this on a rather obscure forum:

The apache user is disallowed to make http connections by default. To enable this, do the following from root:

setsebool -P httpd_can_network_connect 1

that was found on http://forums.phpfreaks.com/topic/64806-solved-could-not-connect-to-server-permission-denied/

다른 팁

Two points:

  1. The user account under which Apache is running (assuming that you're serving the repository with Apache) must have permission to do everything your script is attempting to do.
  2. Hook scripts execute in an empty environment - no environment variables are set, not even $PATH. So those binaries you're attempting to execute (svnlook & telnet) aren't found. You need to specify the full path to those, or set a $PATH in your script.
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top