Ryan Schmidt wrote:
>
> On Feb 8, 2006, at 22:10, Josh Kuo wrote:
>
> Ah, now this topic is interesting to me. For the longest time I've
> wanted to spawn off a process in a post-commit hook to do some extra
> work after the commit is done, without making the client wait for it,
> but I never got around to trying it. Well thanks to this thread, now I
> have, and I also can't get the post-commit hook to relinquish control
> back to the client until the spawned process is completed.
>
> My repository is in /tmp/repo. Here's the post-commit hook:
>
> #!/bin/sh
>
> REPO="$1"
> REV="$2"
>
> /tmp/repo/hooks/countdown.sh "${REPO}" "${REV}" >/dev/null 2>&1 &
Try to close the STDIN as well? Disclaimer: I didn't.
/tmp/repo/hooks/countdown.sh "${REPO}" "${REV}" &>/dev/null </dev/null &
Whenever I spawn a remote process via SSH, I need to do this in order to be
able to leave the session/logout cleanly.
NB: >dev/null 2>&1 == &>/dev/null for bash-3* at least
> And here's countdown.sh:
>
> #!/bin/sh
>
> REPO="$1"
> REV="$2"
>
> for ((i=5; i>0; i-=1)); do
> sleep 1
> echo `date` REPO=${REPO} REV=${REV} PID=$$ I=$i >> /tmp/svnlog.txt
> done
>
> And then in one window I monitor svnlog.txt:
>
> tail -f /tmp/svnlog.txt
>
> And in another, I change a file in a working copy and commit it:
>
> echo `date` > foo && svn ci -m ""
>
> It outputs this:
>
> Sending foo
> Transmitting file data .
>
> And I get the countdown in the log file. And only after the countdown
> finishes does the commit finish:
>
> Committed revision 7.
>
> This is Subversion 1.3.0 with APR 1.2.2 compiled through DarwinPorts on
> Mac OS X 10.4.4 PPC. It's an FSFS repository created just now for
> testing, accessed via the file:// protocol.
My 2 yen above.
Kalin.
--
|[ ~~~~~~~~~~~~~~~~~~~~~~ ]|
+-> http://ThinRope.net/ <-+
|[ ______________________ ]|
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Feb 9 03:57:09 2006