简体   繁体   中英

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

I'd like it to run in the background so that git does not get delayed after a commit. I've tried various techniques (exec, piping to "at now", nohup) but when I use any of these techniques no email gets sent. I suspect this has something to do with the use of stdin to pass in the args to the hook.

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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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