4

I have created a subversion post-commit hook to send out an email everytime a commit is made.Im calling a python script from the file post-commit in /var/svn/repos/hooks .

REPOS="$1"
REV="$2"

~/svnnotify.py $REV

But the problem is that the svn commit command is taking a longer time to terminate as it waits for the python script to terminate first . Is there any way around this ?

Thank You

bahrep
  • 29,961
  • 12
  • 103
  • 150
JoeRP
  • 61
  • 1
  • 6

3 Answers3

4

Try adding an ampersand (&) after the line that calls your script to put it in the background and return immediately.

Paul McMillan
  • 19,693
  • 9
  • 57
  • 71
  • thanks for the reply :)..i have tried that..doesnt seem to work..is it because im passing an argument to the script ? – JoeRP Nov 21 '09 at 06:01
  • 3
    The `&` at the end works fine for me. Could be because I'm also redirecting the output (at the moment to a temporary log file, could also be /dev/null, of course): `/some/dir/bin/pythonscript >> /tmp/my_thingy.log 2>&1 &` is what my post-commit hook looks like. – Reinout van Rees Nov 22 '09 at 16:27
0

Call a batch file and in that batch file execute python script to run in the background by adding ampersand at end of command in batch file( & ).

Umesh
  • 1,242
  • 1
  • 13
  • 24
0

Maybe put the update in a simple queue that gets scooped up by a script run invoked from cron and sends a message if something is sitting in the queue.

Queue could be a simple file in /tmp, an sqlite file, or a MySQL table.

If it's taking noticeably long to send the e-mail, maybe there's something up with the code in the notify script. It shouldn't take that long to put an e-email in the local mail queue.

Jim
  • 1,604
  • 1
  • 14
  • 17