简体   繁体   English

如何在后台运行git post-receive-email?

[英]How can I run the git post-receive-email in the background?

I have a post-receive hook that just calls /usr/share/git-core/contrib/hooks/post-receive-email 我有一个后接收钩子,它仅调用/ usr / share / git-core / contrib / hooks / post-receive-email

I'd like it to run in the background so that git does not get delayed after a commit. 我希望它在后台运行,以便git在提交后不会延迟。 I've tried various techniques (exec, piping to "at now", nohup) but when I use any of these techniques no email gets sent. 我尝试了各种技术(执行程序,管道传递到“现在”,nohup),但是当我使用这些技术中的任何一种时,都不会发送电子邮件。 I suspect this has something to do with the use of stdin to pass in the args to the hook. 我怀疑这与使用stdin将args传递给钩子有关。

I guess I need to capture stdin but I've no idea how to do that. 我想我需要捕获标准输入,但是我不知道该怎么做。

Any suggestions? 有什么建议么?

While this is probably not the answer you want, you could decouple the hook from the mail delivery using cron and a mail delivery script, dropping your desired email into a directory and having your script pick it up. 尽管这可能不是您想要的答案,但是您可以使用cron和邮件传递脚本将钩子与邮件传递分离,将所需的电子邮件放入目录中,然后让脚本来处理。 If you didnt want to wait for the cron every-minute boundary, you could hack up a daemon that uses inotify to monitor that directory for dropped files. 如果您不想等待cron的每一分钟边界,则可以破解一个使用inotify监视该目录中是否有丢失文件的守护程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM