Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Re: forking and avoiding zombies! (http://www.velocityreviews.com/forums/t955368-re-forking-and-avoiding-zombies.html)

peter 12-11-2012 01:34 PM

Re: forking and avoiding zombies!
 
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..

You don't need to move away from the current directory. You cant use os
to get the current work directory

stderrfile = '%s/error.log' % os.getcwd()
stdoutfile = '%s/out.log' % os.getcwd()

then call the daemon function like this.

daemonize(stdout=stdoutfile, stderr=stderrfile)

Thomas Rachel 12-11-2012 03:15 PM

Re: forking and avoiding zombies!
 
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 otherwise I need another chdir after..

> You don't need to move away from the current directory. You cant use os
> to get the current work directory
>
> stderrfile = '%s/error.log' % os.getcwd()
> stdoutfile = '%s/out.log' % os.getcwd()


ITYM

os.path.join(os.getcwd(), 'error.log')

resp.

os.path.join(os.getcwd(), 'out.log')


Thomas


All times are GMT. The time now is 08:13 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.