source: XMLIO_V2/tools/FCM/examples/svn-hooks/post-commit @ 81

Last change on this file since 81 was 81, checked in by ymipsl, 12 years ago

ajout FCM 1.5

File size: 2.2 KB
Line 
1#!/bin/ksh
2
3# POST-COMMIT HOOK
4#
5# The post-commit hook is invoked after a commit.  Subversion runs
6# this hook by invoking a program (script, executable, binary, etc.)
7# named 'post-commit' (for which this file is a template) with the
8# following ordered arguments:
9#
10#   [1] REPOS-PATH   (the path to this repository)
11#   [2] REV          (the number of the revision just committed)
12#
13# The default working directory for the invocation is undefined, so
14# the program should set one explicitly if it cares.
15#
16# Because the commit has already completed and cannot be undone,
17# the exit code of the hook program is ignored.  The hook program
18# can use the 'svnlook' utility to help it examine the
19# newly-committed tree.
20#
21# On a Unix system, the normal procedure is to have 'post-commit'
22# invoke other programs to do the real work, though it may do the
23# work itself too.
24#
25# Note that 'post-commit' must be executable by the user(s) who will
26# invoke it (typically the user httpd runs as), and that user must
27# have filesystem-level permission to access the repository.
28#
29# On a Windows system, you should name the hook program
30# 'post-commit.bat' or 'post-commit.exe',
31# but the basic idea is the same.
32#
33# The hook program typically does not inherit the environment of
34# its parent process.  For example, a common problem is for the
35# PATH environment variable to not be set to its usual value, so
36# that subprograms fail to launch unless invoked via absolute path.
37# If you're having unexpected problems with a hook program, the
38# culprit may be unusual (or missing) environment variables.
39#
40# Here is an example hook script, for a Unix /bin/sh interpreter.
41# For more examples and pre-written hooks, see those in
42# the Subversion repository at
43# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and
44# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/
45
46REPOS=$1
47REV=$2
48
49CMD=${REPOS}/hooks/post-commit-background
50ERR=''
51
52if [[ -x $CMD ]]; then
53  $CMD $REPOS $REV >/dev/null 2>&1 &
54  RC=$?
55
56  if ((RC != 0)); then
57    ERR="$CMD failed ($RC)"
58  fi
59
60else
61  ERR="$CMD does not exist"
62fi
63
64if [[ -n $ERR ]]; then
65  /bin/mail -s "$ERR" my.name@somewhere.org <<EOF
66$(date): $ERR
67EOF
68fi
Note: See TracBrowser for help on using the repository browser.