Apache and os.fork() in CGI-Binaries

Simon Budig Simon.Budig at unix-ag.org
Mon Mar 12 11:15:12 EST 2001


Matt Harden <matth at ninenet.com> wrote:
> You need os.dup2().  Like this:
>    logfile = os.open("/path/to/logfile",os.O_CREAT|os.O_WRONLY)
>    os.lseek(logfile, 0, 2)  /* seek to end */
>    os.dup2(logfile, sys.stdout.fileno())
>    os.dup2(logfile, sys.stderr.fileno())
>    os.close(logfile)
> 
> I would also close stdin like this:
>    devnull = os.open("/dev/null", os.O_RDONLY)
>    os.dup2(devnull, sys.stdin.fileno())
>    os.close(devnull)

Thanks, this helped. Not nice, but it worked.

Bye,
        Simon
-- 
      Simon.Budig at unix-ag.org       http://www.home.unix-ag.org/simon/



More information about the Python-list mailing list