Subversion 提交后挂钩
我创建了一个 subversion post-commit 挂钩,以便在每次提交时发送一封电子邮件。我从 /var/svn/repos/hooks 中的文件 post-commit 调用 python 脚本。
REPOS="$1"
REV="$2"
~/svnnotify.py $REV
但问题是 svn commit 命令需要更长的时间才能终止,因为它等待 python 脚本首先终止。有什么办法解决这个问题吗?
谢谢
I have created a subversion post-commit hook to send out an email everytime a commit is made.Im calling a python script from the file post-commit in /var/svn/repos/hooks .
REPOS="$1"
REV="$2"
~/svnnotify.py $REV
But the problem is that the svn commit command is taking a longer time to terminate as it waits for the python script to terminate first . Is there any way around this ?
Thank You
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试在调用脚本的行后面添加一个与号 (
&
),以将其置于后台并立即返回。Try adding an ampersand (
&
) after the line that calls your script to put it in the background and return immediately.调用批处理文件,并在该批处理文件中执行 python 脚本,通过在批处理文件中的命令末尾添加“&”来在后台运行。
Call a batch file and in that batch file execute python script to run in the background by adding ampersand at end of command in batch file( & ).
也许将更新放入一个简单的队列中,该队列由从 cron 调用的脚本运行来获取,并在队列中存在某些内容时发送消息。
队列可以是 /tmp 中的一个简单文件、一个 sqlite 文件或一个 MySQL 表。
如果发送电子邮件的时间明显较长,则可能是通知脚本中的代码出现问题。将电子邮件放入本地邮件队列应该不会花那么长时间。
Maybe put the update in a simple queue that gets scooped up by a script run invoked from cron and sends a message if something is sitting in the queue.
Queue could be a simple file in /tmp, an sqlite file, or a MySQL table.
If it's taking noticeably long to send the e-mail, maybe there's something up with the code in the notify script. It shouldn't take that long to put an e-email in the local mail queue.