1

Possible Duplicate:
How do you create a daemon in Python?

I am looking at a way to create long lived processes in Python . By long lived i mean processes that ignore signal handlers, are disassociated from the controlling terminal, etc.

Python's threading module has the ability to create daemon threads although i cannot find confirmation if these daemon threads can behave as the long living process.

Community
  • 1
  • 1
Cheezo
  • 761
  • 9
  • 24
  • 1
    If you are on a UNIX-based OS, prefixing your command with "nohup" (for no hangup) will make it persist even after the terminal is closed and even after the user who has begun the process is disconnected. Would os.system("nohup " + command) fit your needs? Or simply using "nohup python my_long_living_process"? – algorowara Aug 01 '12 at 13:31

2 Answers2

2

You can use the code by Sander Marechal on his blog

Matt Williamson
  • 39,165
  • 10
  • 64
  • 72
1

Use python-daemon, an implementation of the draft PEP 3143

Nicolas Barbey
  • 6,639
  • 4
  • 28
  • 34