Cannot svn update during SVN post-commit

Asked 2 years ago, Updated 2 years ago, 95 views

Once the source has been committed to the subversion, we would like to update the files in the HTML area on the same server with svn update.I am using post-commit, a subversion hook script, but it does not work.

Specifically, the hook script itself works in the same situation as the one below, but only the svn update is not working (manual tapping of the command output from echo in the log works fine...)

▽ Unable to update svn during post-commit of subversion
  http://tadtak.jugem.jp/?eid=63

なお I tried all the solutions listed here, but it didn't work...

The environment has a package called "Bitnami Redmine" on Amazon Linux.

The hook script and log contents are listed below.
Please tell me the possible causes!

Here's what's in the hook script

#!/bin/sh
# Define Variables
LOG=/var/log/svn/post-commit.log
REPOS="$1"
REV = "$2"
SVNUSER= ProtoPostCommit
SVNPASS= ProtoPostCommit
SVNCONFIGDIR=/opt/redmine-3.0.1-0/subversion/bin/
SVNOPTS="--username${SVNUSER}--password${SVNPASS}--config-dir${SVNCONFIGDIR}"
PROTOHTML=/opt/redmine-3.0.1-0/apache2/htdocs/test_proto

# Start!
echo "START${REPOS}${REV}">>${LOG}

# Move to Proto Area
cd${PROTOHTML}
# SVN UPDATE
${SVNCONFIGDIR}svn update*${SVNOPTS}>>${LOG}

# Check for commands that are ejected
echo "${SVNCONFIGDIR}svn update*${SVNOPTS}">${LOG}
# End...
echo "END${REPOS}${REV}">>${LOG}

Here's what's in the spouted "/var/log/svn/post-commit.log"

START/opt/redmine-3.0.1-0/repositors/test_proto6
/opt/redmine-3.0.1-0/subversion/bin/svn update* --username ProtoPostCommit --password ProtoPostCommit --config-dir/opt/redmine-3.0.1-0/subversion/bin/
END/opt/redmine-3.0.1-0/repositors/test_proto6

svn

2022-09-30 20:45

2 Answers

I don't know the cause at a glance, but please try to record the standard error output in the log file so that it can be checked.It is also recommended that you implement actions in the event of an error.

If each command fails, exit at that point (set-e) and log standard error output as well as standard output (two exec):

#!/bin/sh

set-e

exec>>/var/log/svn/post-commit.log
exec2>&1

# Define Variables
REPOS="$1"
REV = "$2"
SVNUSER= ProtoPostCommit
SVNPASS= ProtoPostCommit
SVNCONFIGDIR=/opt/redmine-3.0.1-0/subversion/bin/
SVNOPTS="--username${SVNUSER}--password${SVNPASS}--config-dir${SVNCONFIGDIR}"
PROTOHTML=/opt/redmine-3.0.1-0/apache2/htdocs/test_proto

# Start!
echo "START${REPOS}${REV}"

# Move to Proto Area
cd${PROTOHTML}
# SVN UPDATE
${SVNCONFIGDIR}svn update*${SVNOPTS}

# Check for commands that are ejected
echo "${SVNCONFIGDIR}svn update*${SVNOPTS}"
# End...
echo "END${REPOS}${REV}"


2022-09-30 20:45

Regarding the question I was asking, I solved myself.

In the documentation in the question, you can specify a character code as follows to solve the problem,
resolve the problem. It says, but if you do it like this, it's done!
(I thought I tried it before, but it didn't seem to work...)

LANG=en_US.UTF-8/usr/bin/svn${SVNOPTS} update/var/www/html>>${LOG}
~~~~~~~~~~~~~~~~

[Reference] Unable to update svn during post-commit of subversion
http://tadtak.jugem.jp/?eid=63

Sorry for the trouble.


2022-09-30 20:45

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.