Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 692373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:38:38+00:00 2026-05-14T02:38:38+00:00

I have a post-commit hook in svn that runs fine from the command line

  • 0

I have a post-commit hook in svn that runs fine from the command line when I run

env - ./foo.sh /path/to/svn/repos/ 12345

but when the script is called from svn it does not appear to work.

What I am basically doing is checking the committed files and if a particular file is modified, I do an svn export of it to a network share. Works fine from the command line.

The post-commit script is as follows:

#!/bin/sh

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

CHANGED=`/usr/bin/svnlook changed -r "$REV" "$REPOS"`
SOURCE="svn+ssh://localhost/path/to/svn/repos/somefile.zip"
DEST="/mnt/build/somefile-r$REV.zip"

if [[ "$CHANGED" =~ "trunk/somedir/somefile.zip" ]]
then
        `/usr/bin/svn export --non-interactive --trust-server-cert $SOURCE $DEST`
fi

exit 0

Is there a way to output any error messages to a file when the script runs, or specifically the svn export line (where I think there might be an issue)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T02:38:39+00:00Added an answer on May 14, 2026 at 2:38 am

    The standard output from a hook script is discarded, but the standard error goes back to the client, at least in recent versions of Subversion. I thought it had been like this for a while, but the svn 1.4 book says that the output is discarded, so you might like to check that you’re running an up-to-date version of the server — seeing the standard error stream is a good way to get early warning of common types of error.

    To send the output from a command to a file, and include the standard error output in the file too to keep it all in one place, do

    command >/path/to/logfile 2>&1
    

    Use >> rather than > to append to the file:

    command >>/path/to/logfile 2>&1
    

    Because the standard error output is sent back to the svn client, you can also pass the information from the standard output back that way, either for a single command,

    command 1>&2
    

    or for the whole script, by putting

    exec 1>&2
    

    at the top of the script.

    At a glance, I do see one issue with your script: assuming the backquotes on the svn export line are not an artefact of the markup, you should remove them. (They will execute the export command that you’ve written, and then take its output, and execute that output as another command — almost certainly not what you intended.)

    if [[ "$CHANGED" =~ "trunk/somedir/somefile.zip" ]]
    then
            /usr/bin/svn export --non-interactive --trust-server-cert $SOURCE $DEST 1>&2
    fi
    

    (I didn’t know about the double-square-bracket test syntax in bash, that’s a nice new discovery for me!)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 352k
  • Answers 352k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer jQuery will fail to select by id $('#foo[1]') since it… May 14, 2026 at 7:35 am
  • Editorial Team
    Editorial Team added an answer The point of the \left( \right) syntax is to have… May 14, 2026 at 7:35 am
  • Editorial Team
    Editorial Team added an answer The following steps normally work for me: Use the standard… May 14, 2026 at 7:35 am

Related Questions

We have a staging version of our web application (it is basically a subversion
I'm trying to provide integration to my django application from subversion through the post
I have created a subversion post-commit hook to send out an email everytime a
I have a post-commit hook that is updating a working copy. In that working
I am using an SVN repository for my web development work. I have a

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.