views:

335

answers:

1

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.

+2  A: 

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.

RedGlyph
I didn't resolve my issue of my post-commit.bat running , but these user, and path suggestions were helpful in eliminating those potential issues. Thanks
datatoo
Debugging those hook scripts is very difficult sometimes as it's hard to be in the same conditions to test it. If you still have this problem, you could 1) produce a log file at the very beginning of the script (careful about the permissions!) and further in the script to trace it; 2) open a command shell window under the same account as the server and launch it manually with plausible parameters. In the log file, you could also dump all the env. variables (set > log.txt), that's often the problem.
RedGlyph