Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
さて、私はpython-daemonと、他のさまざまなデーモン関連のコードレシピを見てきました。Pythonベースのデーモン化されたプロセスの使用を開始するのに役立つ「helloworld」チュートリアルはありますか?
PEP 3143にはいくつかの例が含まれており、そのうちの最も単純なものは次のとおりです。
import daemon from spam import do_main_program with daemon.DaemonContext(): do_main_program()
これは、それが得られるのと同じくらい簡単に思えます。不明な点があれば、具体的に質問してください。
subprocess.Popenを使用すると、現在のプロセスを存続させる別のプロセスを起動できます...
Pythonコンソールで実行:
import subprocess subprocess.Popen(["/bin/sh", "-c", "sleep 500"])
あなたのコンソールを殺し、既存のプロセスを見て、睡眠は生きています...