使用python守护进程 [英] Using python, daemonizing a process
本文介绍了使用python守护进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
好吧,我已经看过python-daemon以及各种其他与守护程序相关的代码配方。是否有任何 hello world教程可以帮助我开始使用基于python的守护进程?
Okay I have looked at python-daemon, and also at various other daemon related code recipes. Are there any 'hello world' tutorials out there that can help me get started using a python based daemonized process?
推荐答案
a href = http://www.python.org/dev/peps/pep-3143/ rel = nofollow noreferrer> PEP 3143 包含几个示例,其中最简单的示例是:
The PEP 3143 contains several examples, the simplest one of which is:
import daemon
from spam import do_main_program
with daemon.DaemonContext():
do_main_program()
这似乎很简单。如果有不清楚的地方,请提出具体问题。
This seems as straightforward as it gets. If there's something that's unclear, please pose specific questions.
这篇关于使用python守护进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文