Question

Apache on a windows machine running as SYSTEM.
What user and password should be used for a post-commit.bat?

I am trying to copy content to a directory for testing on a developer version on the webserver and don't seem to have it working.

Was it helpful?

Solution

The hook scripts will be launched by the server, so you only need to make sure the corresponding user (SYSTEM for you) has

  • read/write access to the repositories (which should already be the case)
  • read/execute access to the hook script

Depending on what your script does, you may need more, for example if it creates a log - if it accesses other resources in general. That's probably the problem you have encountered.

Also, if the hook script is a .bat, the COMSPEC environment variable is needed to find the shell (I had this problem with Windows XP, it was mainly due to a bad configuration). This variable is typically defined as C:\Windows\system32\cmd.exe. PATH is also very important of course.

Note that it could be misleading, when you test the script with another user login you may have another access your server identity won't.


Edit: It is possible to set or expand important environment variables like PATH and COMSPEC at the beginning of the batch script, if you are not sure what they contain with the server account. For example,

SET ComSpec=%SystemRoot%\system32\cmd.exe
SET PATH=%PATH%;C:\Tools\SVN\svn-win32-1.4.6\bin

Sometimes it is easier than being in the dark and trying to modify the server's account.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top