daemons and GUIs Oh my

Coy Krill ckrill at qvlinc.com
Tue Apr 10 13:31:17 EDT 2001


Timothy Grant wrote:

> On Mon, Apr 09, 2001 at 01:10:38PM -0700, Coy Krill wrote:
> > Timothy Grant wrote:
> >
> > > Hi all,
> > >
> > > I have a function that daemonizes itself. When called in a
> > > command line environment everything works the way I would like
> > > it to--It detaches itself from the console and runs in the
> > > background until killed. However, when called from a button
> > > in a GUI, things quickly get beyond my understanding of what's
> > > going on.
> > >
> > > When I call the same function from a button in Tkinter, the
> > > programme still detaches itself from the console, an as
> > > expected, but not welcomed, the GUI quits functioning until I
> > > kill the process.
> > >
> > > So, How do I call a process that going to be a daemon, and yet
> > > maintain control of my GUI?
> >
> > This all depends on what exactly you're doing with the GUI.  Is it a
> > configurator/launcher, a controller, what?  If the former then use one
> > of the spawn functions from os.  If the latter, then you can start the
> > process via the same method for the former option and then either write
> > a config file and have your daemon respond to SIGHUP (or some other
> > signal) so it rereads the config file and changes behavior, or
> > communicate with it via a socket and custom API to tell it what to
> > change.
>
> Thanks Coy. (BTW: nice daemon code that makes my daemons run
> nicely<wink>).
>
> The GUI is simply a configurator/launcher that has pretty check
> boxes for command line options. My understanding is that spawn
> are only supported on Windows boxes, is that a
> misunderstanding?
>
> --
> Stand Fast,
>     tjg.
>
> Timothy Grant                         tjg at exceptionalminds.com
> Chief Technology Officer              www.exceptionalminds.com
> HyperLINq Technologies, Inc.          <><       (503) 246-3630
> >>>>>>>>>>>>>Linux, because rebooting is *NOT* normal<<<<<<<<<
> >>>>This machine was last rebooted:  13 days  1:21 hours ago<<

Spawn works on Unix.  I believe it does a fork() and exec() under the
covers, but using spawn is multiplatform (at least I think I'm remembering
that fork() and exec() don't work on windows.)

Coy




More information about the Python-list mailing list