info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: How to send mail to exchange server on cvs commint from solar is


From: Bulgrien, Kevin
Subject: RE: How to send mail to exchange server on cvs commint from solar is
Date: Tue, 16 May 2006 10:54:08 -0500

Look at the repository CVSROOT/loginfo post-commit hook function.

Add an entry like:

  ALL /path/to/scripts/postcommit.sh %{sVv}

Where postcommit.sh contains code that runs mailx on SunOS should
do the trick.

postcommit.sh has an interesting API with CVS, but something along
the lines of the following would end up being possible once that
is taken care of.  The following was tried and works on SunOS 5.5.1:

mailx -s "CVS commit notification for ${DIR}" ${USER} <<-END_OF_EMAIL
${D_T}: $(whoami): $(basename "${CVSROOT}"): ${DIR}: ${LST}
END_OF_EMAIL

It really does not matter what your receiving mail system is as
long is the SunOS system is already set up to send mail.  My test
just worked.  The SunOS system happened to have to forward it to
a linux system, but the ultimate destination was an Exchange
server, but the linux system did not have to know that.

I have a BASH example of postcommit.sh which might not work if
you do not have BASH on the SunOS system, but you could pull off
the same thing by replacing code as follows:

 ${blah1#blah2}           --> echo $blah1 | sed -e 's/^blah2//' -
 ${blah3%blah4}           --> echo $blah3 | sed -e 's/blah4$//' -
 ${blah5//blah6/blah7}    --> echo $blah5 | sed -e 's/blah6/blah7/' -
 $(blah)                  --> `blah`

In the example, cvs_email.sh might be the above mailx sample, or an
external script that has something like that in it.

---

#!/bin/bash
#
# This creates the following script parameter format:
#   module file1,oldversion,newversion file2,oldversion,newversion ...
#
# The script will run as the user doing the commit.

EXE=/path/to/scripts

LST="${*#* }"
DIR="${*//% ${LST}/}"
D_T=$(date "+%m/%d/%y %H:%M:%S")

# Script API
#
# -t "Date time"
# -d "module directory" (Could be null if top-level directory)
#
# ${LST} parameters are now a list of files with revision information:
#   file1,orev,rev file2,orev,rev ...
#
# If ${LST} begins with "-", the parameters are simply a text message.  For
# example:
#   - New Directory
#
# Subordinate scripts must handle exception cases where the first parameter
# is a "-".
#
# The following variables are defined by CVS and available for use:
#   CVSROOT   -
#   CVSEDITOR -
#   EDITOR    -
#   VISUAL    -
#   USER      - not necessarily the same as $(whoami)
#
${EXE}/cvs_email.sh -t "${D_T}" -d "${DIR}" ${LST}
...

# Consume unanticipated extra input to avoid possible errors like:
#   cvs [commit aborted]: received broken pipe signal
#
cat > /dev/null

---

Kevin Bulgrien 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]