Configuration of email notification when svn commits

I installed svn version 1.6.11 on centos with yum and
created a library named repo1.
I want to use the hooks in repo1 to configure the email notification
hooks when submitting code. Explanation: http://blog.csdn.net/littlegrizzly/ article/details/7371517

I found the mailer.py file in the /usr/share/doc/subversion-1.6.11/tools/hook-scripts/mailer/ directory, so use mailer.py to

send mail when mailer.py sends mail You also need a configuration file, an example of this configuration file should be in the /usr/share/doc/subversion-1.6.11/tools/hook-scripts/mailer directory, named mailer.conf.example, you can copy this file to In repo1/conf, and modify the file name to mailer.conf

Next, modify the content of the mailer.conf file, where the modifications are:
smtp_hostname = smtp.qq.com
smtp_username = [email protected]
smtp_password = xxxxx
from_addr = [email protected] (Note: The email address here should be the same as smtp_username, and from_addr is under the [defaults] label, and there is also a from_addr in [general], do not modify it)
to_addr = [email protected] [email protected] (multiple separated by spaces)

Others do not change,

and then modify the post-commit.tmpl file under repo1/hooks,
rename it to post-commit, and attach the executable permission chmod a+x post-commit
to modify its content as follows:
/usr/share/doc/subversion-1.6.11/tools/hook-scripts/mailer/mailer.py commit "$REPOS" "$REV" /repo1/conf/mailer.conf

if [ $? -ne 0 ]; then  
    echo "failure to mailer.py commit $REPOS $REV" >> /repo1/conf/mail.log  
be  

Note that the above code has a mail.log, which is used to record the log when sending.

Well , now you can send mail every time you submit

another: you can test like this
/usr/share/doc/subversion-1.6.11/tools/hook-scripts/mailer/mailer.py commit /repo1 184 /repo1/conf/mailer.conf

Among them, 184 is the version number when svn was submitted. This version number must exist on svn, otherwise an error will be reported svn.core.SubversionException: ('No such revision 1847', 160006)

How to know the version number submitted by svn: I am configuring During the process, the test was submitted in the svn plug-in of eclipse. Unfortunately, the first mail sending was unsuccessful. Then I checked the mail.log, and the version number of the failed submission was recorded, so I got an svn existence. version number, and then use the above code to test directly on the command line

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326717216&siteId=291194637