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 wh

Re: forking and avoiding zombies!

2012-12-11 Thread andrea crotti
2012/12/11 Dennis Lee Bieber : > On Tue, 11 Dec 2012 10:34:23 -0300, peter declaimed > the following in gmane.comp.python.general: > >> >> stderrfile = '%s/error.log' % os.getcwd() >> stdoutfile = '%s/out.log' % os.getcwd() >> > Ouch... > > stdoutfile = os.path.join(os.getcwd(), "o

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 othe

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 st

Re: forking and avoiding zombies!

2012-12-11 Thread andrea crotti
2012/12/11 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 m

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 per

Re: forking and avoiding zombies!

2012-12-11 Thread andrea crotti
2012/12/11 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, >> o

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.. Y

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.. -- http://mail.python.org/mailman/listinfo/pyth

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 fo

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-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 p