使用 GNU Screen 代替守护进程
我刚刚接管了一个遗留应用程序,该应用程序在 GNU 屏幕会话中启动后台进程,而不是对它们进行守护进程。我试图弄清楚为什么最初的程序员会这样写。在屏幕上启动进程而不是分叉它们或使用 nohup
启动它们是否有充分的理由?
I just took over a legacy application that launches background processes in GNU screen sessions rather than daemonizing them. I'm trying to figure out why the original programmer wrote it this way. Is there a good reason for launching processes in screen rather than forking them or launching them with nohup
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
@Marc B 评论提出了一个非常好的观点(多么不幸,它不是一个答案,这将是一个很好的答案!)。不管怎样,我看到的另一个原因是使用 screen 来伪守护应用程序太容易了。
就我而言,我经常这样做。例如,我正在为我的公司开发一个 Django 应用程序,我将在将来的某个时间展示该应用程序。它并不完整,但对我很有用,因此我在屏幕会话中启动它,并在需要时将其保留下来以供使用。
@Marc B comment presents a very good point (how unfortunate it is not an answer, it would be a good one!). Anyway, another reason I see is the fact that it is just too easy to use screen for pseudodaemonizing an application.
I, for one, do it a lot. For example, I am developing a Django application for my company, that I will present some time in the future. It is not complete but is useful to me, so I started it in a screen session and leaved it available for use when I need it.