You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Alien8 Recordings <al...@alien8recordings.com> on 2006/03/09 23:26:31 UTC

post-commit hook fails

Hi All,

I've scoured the mailing list and the web for info on why my post- 
commit hook might be failing. It seems to be a very common problem  
and most of the threads I read seemed to remain unresolved. In any  
case I am trying to do execute the following simple post-commit script:

---------
#!/bin/bash

REPOS="$1"
REV="$2"
/usr/bin/svnadmin dump /var/svn --revision $REV --incremental > / 
backup/svn_backups/dump$REV &> /tmp/postout.txt
---------

I am running svn with mod_dav through apache. I made the script  
executable to apache and the backup directory is owned by apache. The  
script works just fine when I execute through the shell, but when I  
commit nothing seems to happen. The stdout/err file is never written.  
Does anyone have any suggestion about how I could solve this problem?  
Am I missing something?

Thanks,
Sean


______________
ALIEN8 RECORDINGS
P.O. BOX 666, STATION R
MONTREAL, QC
CANADA, H2S 3L1

http://www.alien8recordings.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: post-commit hook fails

Posted by Alien8 Recordings <al...@alien8recordings.com>.
Hi Bob,

Thanks for your insight. The change actually worked to deliver the  
following error message:
/var/svn/hooks/post-commit: line 47: /backup/svn_backups/dump41:  
Permission denied

The svn_backup directory was owned by apahce, but the parent  
directory was owned by root and unreadable by all other users/groups.  
I chmod'ed 755 on the parent directory and now it's working. THanks!

Take care,
Sean

On 9-Mar-06, at 7:06 PM, Bob Proulx wrote:

> Alien8 Recordings wrote:
>> I am trying to do execute the following simple post-commit script:
>>
>> ---------
>> #!/bin/bash
>>
>> REPOS="$1"
>> REV="$2"
>> /usr/bin/svnadmin dump /var/svn --revision $REV --incremental > /
>> backup/svn_backups/dump$REV &> /tmp/postout.txt
>
> You make a typo.  The & puts the command in the background and the >
> redirects the next command to the output file.  I think you wanted
> "2>" here.  No need for >& to do synchronous updates since this is a
> different file from fd 1.
>
>   s/&>/2>/
>
>   /usr/bin/svnadmin dump /var/svn --revision $REV --incremental > / 
> backup/svn_backups/dump$REV 2> /tmp/postout.txt
>
>> ... but when I commit nothing seems to happen. The stdout/err file
>> is never written.  Does anyone have any suggestion about how I could
>> solve this problem?  Am I missing something?
>
> Easier to redirect all output to a file for all commands.  See the
> additional 'exec' line below for an example.
>
>   #!/bin/bash
>   exec >/tmp/post-commit.out 2>&1
>   REPOS="$1"
>   REV="$2"
>   /usr/bin/svnadmin dump /var/svn --revision $REV --incremental > / 
> backup/svn_backups/dump$REV
>
> Bob
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>
>

______________
ALIEN8 RECORDINGS
P.O. BOX 666, STATION R
MONTREAL, QC
CANADA, H2S 3L1

http://www.alien8recordings.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: post-commit hook fails

Posted by Bob Proulx <bo...@proulx.com>.
Alien8 Recordings wrote:
> I am trying to do execute the following simple post-commit script:
> 
> ---------
> #!/bin/bash
> 
> REPOS="$1"
> REV="$2"
> /usr/bin/svnadmin dump /var/svn --revision $REV --incremental > / 
> backup/svn_backups/dump$REV &> /tmp/postout.txt

You make a typo.  The & puts the command in the background and the >
redirects the next command to the output file.  I think you wanted
"2>" here.  No need for >& to do synchronous updates since this is a
different file from fd 1.

  s/&>/2>/

  /usr/bin/svnadmin dump /var/svn --revision $REV --incremental > /backup/svn_backups/dump$REV 2> /tmp/postout.txt

> ... but when I commit nothing seems to happen. The stdout/err file
> is never written.  Does anyone have any suggestion about how I could
> solve this problem?  Am I missing something?

Easier to redirect all output to a file for all commands.  See the
additional 'exec' line below for an example.

  #!/bin/bash
  exec >/tmp/post-commit.out 2>&1
  REPOS="$1"
  REV="$2"
  /usr/bin/svnadmin dump /var/svn --revision $REV --incremental > /backup/svn_backups/dump$REV

Bob

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org