how to detach process

Noah noah at noah.org
Sun Aug 25 22:38:45 EDT 2002


"Dilton McGowan II" <diltonm at pacbell.net> wrote in message news:<pM_99.328$xP6.29917197 at newssvr21.news.prodigy.com>...
> "Noah" <noah at noah.org> wrote in message
> news:c9d82136.0208232259.4191800 at posting.google.com...
> > alienoid <alienoid at is.lg.ua> wrote in message
>  news:<mailman.1030137902.27254.python-list at python.org>...
> > > Hello python-list users,
> > >
> > > I need your help with this case:
> > > ...
> > > Thanks in advance
> >
> > I'm not sure what comp A has to do with it.
> > It seems that your problem is the same even if described without comp A.
> >
> > It sounds like you want to create a daemon process using Python.
> > In UNIX this requires a "double fork" to detatch a process
> > from the controlling terminal (login shell). The following code
> > gives the basic daemon outline. In your case you would probably want the
> > main() function to exec program C. See the os module for 'exec' functions.
> > There are many of them:
> > Yours,
> > Noah Spurrier
> 
> Could this technique be used by someone as a CGI parasitical spawn, sucking
> CPU cycles long after the original CGI died?

Sure, but you phrase it like that's a bad thing.
No authorized user browsing your web site could do this.
Only the programmer authorized to install CGI scripts could do this.
(baring some sort of back door security hole).
But it's a perfectly valid (if dangerous) thing to do.
You could have a admin CGI script that lets to start daemons
from the web... The danger could be that if someone unfriendly
discovers a way to access your CGI then they could keep refreshing
the CGI to launch your daemon over and over again. Presumably your
daemon is coded to not allow multiple instances to run ;-)

Yours,
Noah



More information about the Python-list mailing list