twistd 和 nohup &:有什么区别?

twistd and nohup &: what is the difference?

使用 twistd 比 nohup 有什么优势?

为什么

twistd -y service.tac

我什么时候可以做:

nohup sudo python my_app.py &

?

我问这个是因为我在使用 twistd 时遇到了困难,请参阅 my question here

nohup vs. daemonization 在 this answer 中有很好的解释,基本上可以 tl;dr'd to nohup command &"可怜的人;s守护进程的方式,因为它没有经历守护进程所经历的所有步骤。一些细微差别:

  • nohup 不会成为进程组组长,也不会从执行它的 shell 会话中分离出来,即使子shelled(即, (nohup command &) vs nohup command &,括号不同,
  • "has the same controlling terminal - it just ignores the terminals controls",尽管这可能不适用于上面的子shelled命令(尚未测试)。

简而言之,它不是 "true" 守护进程 - 存在一些差异,现在可能不会出现问题,但如果您将来假设进程真正被守护进程,则可能会出现问题,而实际上它并没有'确实如此,并且像以前一样执行操作。