You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Shalinda Adikari <SA...@virtusa.com> on 2010/01/07 05:53:14 UTC

How to run post-commit as a backgorund process??

 

 

From: Shalinda Adikari 
Sent: Thursday, January 07, 2010 11:15 AM
To: 'issues@subversion.tigris.org'
Subject: How to run post-commit as a backgorund process??

 

Hi Team,

 

I'm working on svn mirroring capability and I have following issue when
it is used.

 

Once svnsync is configured It takes longer time than normal commit.
Simply if we can commit a file within 2s without svnsync mirroring , now
it takes nearly 6s. Therefore, I need to reduce the time gap by
executing svnsync command parallel. According to the svn help files we
are normally to executing svnsync using the post-commit hook. However,
if we can run svnsync as a background process without effecting to
normal commit then user would not see any time lag. 

 

I hope you can help me to find a solution for this issue.

 

Thanks,

Shalinda


---------------------------------------------------------------------------------------------

This message, including any attachments, contains confidential information intended for a specific individual and purpose, and is intended for the addressee only. Any unauthorized disclosure, use, dissemination, copying, or distribution of this message or any of its attachments or the information contained in this e-mail, or the taking of any action based on it, is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail and delete this message.

---------------------------------------------------------------------------------------------

Re: How to run post-commit as a backgorund process??

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jan 6, 2010, at 23:53, Shalinda Adikari wrote:

> I’m working on svn mirroring capability and I have following issue when it is used.
>  
> Once svnsync is configured It takes longer time than normal commit. Simply if we can commit a file within 2s without svnsync mirroring , now it takes nearly 6s. Therefore, I need to reduce the time gap by executing svnsync command parallel. According to the svn help files we are normally to executing svnsync using the post-commit hook. However, if we can run svnsync as a background process without effecting to normal commit then user would not see any time lag.

The other replies addressed how to do this, but be cautious about doing so. What happens if user 1 commits, which fires off a sync command which takes 4 seconds, and within those seconds, user 2 commits something else, which fires off a second sync command? Do they compete with one another? Or does the second one wait in an orderly fashion for the first one to complete? Be sure you have an answer to this question before you make this change.


Re: How to run post-commit as a backgorund process??

Posted by Olivier Sannier <ob...@free.fr>.
Shalinda Adikari wrote:
> While going through some of the forums, I found following command to do the task.
> $SVNSYNC synchronize URL_TO_MIRROR_REPO --username=svnsync --password=svnsyncpassword>/dev/null 2>/dev/null&
>
> But this solution is rather different to yours one. As you mention in your reply what is the use of having two "&" instead of one"&"??
>    
Not it's not, Didier's solution avoids typing /dev/nul twice.
Basically, the first "&" applies to the 1 and says redirect output 
number 2 on output number 1.
The second & is there to tell the shell to start the command in the 
background and not wait for it.

RE: How to run post-commit as a backgorund process??

Posted by Shalinda Adikari <SA...@virtusa.com>.
Hi Didier,

Thanks for your quick reply. It's really great. 

While going through some of the forums, I found following command to do the task.
$SVNSYNC synchronize URL_TO_MIRROR_REPO --username=svnsync --password=svnsyncpassword >/dev/null 2>/dev/null &

But this solution is rather different to yours one. As you mention in your reply what is the use of having two "&" instead of one "&"??


Kind Regards,
Shalinda


-----Original Message-----
From: Didier Trosset [mailto:didier_trosset@agilent.com] 
Sent: Thursday, January 07, 2010 3:40 PM
To: users@subversion.apache.org
Cc: Shalinda Adikari
Subject: Re: How to run post-commit as a backgorund process??

Shalinda Adikari wrote:
> Hi Team,
> 
> I’m working on svn mirroring capability and I have following issue when 
> it is used.
> 
> Once *svnsync* is configured It takes longer time than normal commit. 
> Simply if we can commit a file within 2s without svnsync mirroring , now 
> it takes nearly 6s. Therefore, I need to reduce the time gap by 
> executing svnsync command parallel. According to the svn help files we 
> are normally to executing svnsync using the post-commit hook. However, 
> if we can run svnsync as a background process without effecting to 
> normal commit then user would not see any time lag.

In your post-commit script, you should start the commands without waiting 
for their completion. Additionally, you should redirect the outputs of the 
command, otherwise the script will also wait for the commands to finish.

You can do this as follows:

   command-to-run >/dev/null 2>&1 &

HTH
Didier

> 
> I hope you can help me to find a solution for this issue.
> 
>  
> 
> Thanks,
> 
> Shalinda
> 
> ---------------------------------------------------------------------------------------------
> 
> This message, including any attachments, contains confidential information intended for a specific individual and purpose, and is intended for the addressee only. Any unauthorized disclosure, use, dissemination, copying, or distribution of this message or any of its attachments or the information contained in this e-mail, or the taking of any action based on it, is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail and delete this message.
> 
> ---------------------------------------------------------------------------------------------
> 



---------------------------------------------------------------------------------------------

This message, including any attachments, contains confidential information intended for a specific individual and purpose, and is intended for the addressee only. Any unauthorized disclosure, use, dissemination, copying, or distribution of this message or any of its attachments or the information contained in this e-mail, or the taking of any action based on it, is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail and delete this message.

---------------------------------------------------------------------------------------------

Re: How to run post-commit as a backgorund process??

Posted by Didier Trosset <di...@agilent.com>.
Shalinda Adikari wrote:
> Hi Team,
> 
> I’m working on svn mirroring capability and I have following issue when 
> it is used.
> 
> Once *svnsync* is configured It takes longer time than normal commit. 
> Simply if we can commit a file within 2s without svnsync mirroring , now 
> it takes nearly 6s. Therefore, I need to reduce the time gap by 
> executing svnsync command parallel. According to the svn help files we 
> are normally to executing svnsync using the post-commit hook. However, 
> if we can run svnsync as a background process without effecting to 
> normal commit then user would not see any time lag.

In your post-commit script, you should start the commands without waiting 
for their completion. Additionally, you should redirect the outputs of the 
command, otherwise the script will also wait for the commands to finish.

You can do this as follows:

   command-to-run >/dev/null 2>&1 &

HTH
Didier

> 
> I hope you can help me to find a solution for this issue.
> 
>  
> 
> Thanks,
> 
> Shalinda
> 
> ---------------------------------------------------------------------------------------------
> 
> This message, including any attachments, contains confidential information intended for a specific individual and purpose, and is intended for the addressee only. Any unauthorized disclosure, use, dissemination, copying, or distribution of this message or any of its attachments or the information contained in this e-mail, or the taking of any action based on it, is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail and delete this message.
> 
> ---------------------------------------------------------------------------------------------
>