Re: forking and avoiding zombies!

2012-12-12 Thread Nobody
On Tue, 11 Dec 2012 13:25:36 +, andrea crotti wrote: But actually why do I need to move away from the current directory of the parent process? It's not required, it's just best practice. Often, the current directory is simply whichever directory it happened to inherit from the shell which

Re: forking and avoiding zombies!

2012-12-11 Thread andrea crotti
Yes I wanted to avoid to do something too complex, anyway I'll just comment it well and add a link to the original code.. But this is now failing to me: def daemonize(stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'): # Perform first fork. try: pid = os.fork() if

Re: forking and avoiding zombies!

2012-12-11 Thread peter
On 12/11/2012 08:47 AM, andrea crotti wrote: Yes I wanted to avoid to do something too complex, anyway I'll just comment it well and add a link to the original code.. But this is now failing to me: def daemonize(stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'): # Perform first

Re: forking and avoiding zombies!

2012-12-11 Thread andrea crotti
Ah sure that makes sense! But actually why do I need to move away from the current directory of the parent process? In my case it's actually useful to be in the same directory, so maybe I can skip that part, or otherwise I need another chdir after.. --

Re: forking and avoiding zombies!

2012-12-11 Thread peter
On 12/11/2012 10:25 AM, andrea crotti wrote: Ah sure that makes sense! But actually why do I need to move away from the current directory of the parent process? In my case it's actually useful to be in the same directory, so maybe I can skip that part, or otherwise I need another chdir after..

Re: forking and avoiding zombies!

2012-12-11 Thread andrea crotti
2012/12/11 peter pjmak...@gmail.com: On 12/11/2012 10:25 AM, andrea crotti wrote: Ah sure that makes sense! But actually why do I need to move away from the current directory of the parent process? In my case it's actually useful to be in the same directory, so maybe I can skip that part,

Re: forking and avoiding zombies!

2012-12-11 Thread Jean-Michel Pichavant
- Original Message - So I implemented a simple decorator to run a function in a forked process, as below. It works well but the problem is that the childs end up as zombies on one machine, while strangely I can't reproduce the same on mine.. I know that this is not the perfect

Re: forking and avoiding zombies!

2012-12-11 Thread andrea crotti
2012/12/11 Jean-Michel Pichavant jeanmic...@sequans.com: - Original Message - So I implemented a simple decorator to run a function in a forked process, as below. It works well but the problem is that the childs end up as zombies on one machine, while strangely I can't reproduce the

Re: forking and avoiding zombies!

2012-12-11 Thread peter
On 12/11/2012 10:57 AM, andrea crotti wrote: where in [] I have the PID of the process. In this suggested way I should use some other files as standard output and error, but for that I already have the logging module that logs in the right place.. It's not realy neccesary do use the stderr and

Re: forking and avoiding zombies!

2012-12-11 Thread Thomas Rachel
Am 11.12.2012 14:34 schrieb peter: On 12/11/2012 10:25 AM, andrea crotti wrote: Ah sure that makes sense! But actually why do I need to move away from the current directory of the parent process? In my case it's actually useful to be in the same directory, so maybe I can skip that part, or

Re: forking and avoiding zombies!

2012-12-11 Thread andrea crotti
2012/12/11 Dennis Lee Bieber wlfr...@ix.netcom.com: On Tue, 11 Dec 2012 10:34:23 -0300, peter pjmak...@gmail.com declaimed the following in gmane.comp.python.general: stderrfile = '%s/error.log' % os.getcwd() stdoutfile = '%s/out.log' % os.getcwd() Ouch... stdoutfile =

Re: forking and avoiding zombies!

2012-12-10 Thread peter
On 12/10/2012 12:42 PM, andrea crotti wrote: So I implemented a simple decorator to run a function in a forked process, as below. It works well but the problem is that the childs end up as zombies on one machine, while strangely I can't reproduce the same on mine.. I know that this is not the