Re: Run daemon + Stop daemon in python

2002-08-14 Thread Sagi Bashari
From: "Eliran" <[EMAIL PROTECTED]> > Then how does fetchmail do that ? Fetchmail stores its PID in ~/.fetchmail.pid > > On Tue, Aug 13, 2002 at 09:16:29PM +0200, Eliran wrote: > > > import os > > childpid = os.fork > > if (childpid == 0): > >child_stuff() > > else: > >

Re: Run daemon + Stop daemon in python

2002-08-14 Thread Eliran
Then how does fetchmail do that ? On Tue, Aug 13, 2002 at 09:16:29PM +0200, Eliran wrote: > import os > childpid = os.fork > if (childpid == 0): >child_stuff() > else: >os.exit() You definitely have to keep it somewhere outside the program, then. /var/run/foo/pid comes t

Re: Run daemon + Stop daemon in python

2002-08-13 Thread Muli Ben-Yehuda
On Tue, Aug 13, 2002 at 09:16:29PM +0200, Eliran wrote: > import os > childpid = os.fork > if (childpid == 0): >child_stuff() > else: >os.exit() You definitely have to keep it somewhere outside the program, then. /var/run/foo/pid comes to mind as a reasonably place (assum

Re: Run daemon + Stop daemon in python

2002-08-13 Thread Eliran
ED]> Sent: Tuesday, August 13, 2002 8:15 PM Subject: Re: Run daemon + Stop daemon in python So, what's the problem again? You have the child's pid, don't you? Not to mention that if you use 'fetchmail -q', you don't need it anyway! You might want to look into os.sy

Re: Run daemon + Stop daemon in python

2002-08-13 Thread Muli Ben-Yehuda
On Tue, Aug 13, 2002 at 09:06:39PM +0200, Eliran wrote: > Take the 'fetchmail' program for example. > > You use 'fetchmail -d nn' to start the daemon, later when you want to stop > it you type : 'fetchmail -q' there is no special structure, I used > the same code as you but the child's code was i

Re: Run daemon + Stop daemon in python

2002-08-13 Thread Eliran
Take the 'fetchmail' program for example. You use 'fetchmail -d nn' to start the daemon, later when you want to stop it you type : 'fetchmail -q' there is no special structure, I used the same code as you but the child's code was in a function. ==

Re: Run daemon + Stop daemon in python

2002-08-13 Thread Muli Ben-Yehuda
On Tue, Aug 13, 2002 at 08:58:26PM +0200, Eliran wrote: > Yes. But my program used : 'software -s' to start the daemon > and later 'software -q' to stop the daemon. What? should I write > the child's pid to a file and later read it ? That would depend entirely on your program's structure. You cou

Re: Run daemon + Stop daemon in python

2002-08-13 Thread Muli Ben-Yehuda
On Tue, Aug 13, 2002 at 08:44:15PM +0200, Eliran wrote: > Hello ! > > How can I start a daemon in python and later use a function to kill it ? The same way it's done in every other programming language? > I used fork & kill the parent but I didn't find anyway to find the child's > pid. Is there

Run daemon + Stop daemon in python

2002-08-13 Thread Eliran
Hello ! How can I start a daemon in python and later use a function to kill it ? I used fork & kill the parent but I didn't find anyway to find the child's pid. Is there a better way ? Thanks alot! = To unsubscribe, send mail to