在Git post-receive hook中运行无限长的进程

时间:2018-06-07 07:37:46

标签: node.js linux git githooks nohup

我在我的服务器上使用Git post-receive hook,这样每当我将更新推送到服务器时,它都会检查新代码,终止当前正在运行的Node应用程序,然后重新启动Node应用程序。问题是客户端在推送到该服务器期间永远不会断开连接,因为它在断开连接之前等待Node进程完成。我试过用&最后,nohup和&一起,并在&。

之后将INSERT INTO table_2 SELECT <new_id_value> id, MAX(id) table_1_id FROM table_1; 添加到它的末尾

我是如何实现这一目标的?

1 个答案:

答案 0 :(得分:0)

我找到了答案here

nohup /usr/local/bin/my_script &>/dev/null &

显然我需要&>/dev/null位。

相关问题