什么是创建Python守护程序的事实库 [英] What is the de facto library for creating Python Daemons
问题描述
我正在尝试使用在我看来是 python-daemon 库是创建守护程序而不忘记任何内容的最安全方法。该文档非常糟糕,只是 PEP 3143 。
I am attempting to use the python-daemon library which seemed to me to be the safest way to create a Daemon without forgetting anything. The documentation is quite poor, being just PEP 3143.
另一方面,我发现了很多与Sander Marechal的使用Python的简单Unix / Linux守护程序。
On the other hand, I have found a lot of links to Sander Marechal's A simple unix/linux daemon in Python. This looks to be a nicer solution or though I have not yet attempted to use it.
编辑:我已经使用了Sander Marechal的解决方案,并且看起来效果很好。
I have used Sander Marechal's solution and it seems to work nicely.
那么在Python社区中创建Daemon的实际方式是什么,是这些库之一,还是干脆做
So what is the de facto way in the Python community to create a Daemon, is it one of these libraries, or simply doing it all yourself (forking twice etc.)?
此外,您会认为任何带有PEP的库都是更好的选择,因为它更接近于一种全面的方法创建守护程序(或至少以一种更标准的方式)的方法比任何其他解决方案都要好。那么,此 python-daemon
包有何处理,它将包含在标准库中吗?
Also, you would think that any library with a PEP would be a far better choice since it is closer to a comprehensive way of creating a Daemon (or at least a more standard way) than any other solution. So what is the deal with this python-daemon
package, would it ever be included in the standard library?
推荐答案
我选择了Sander Marechal的一个简单的Python Unix / Linux守护程序,它很简单,您可以通过创建一个子类并覆盖 run()
方法来使用它,这很自然做事的方式(而不是 with context:
python-daemon模块的方法。
I went with Sander Marechal's A simple unix/linux daemon in Python, it is simple, and you work with it by creating a subclass and overriding the run()
method, which feels a very natural way to do things (rather than the with context:
approach of the python-daemon module.
这篇关于什么是创建Python守护程序的事实库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!