From: roy at popmail.med.nyu.edu (Roy Smith)
Date: Wed, 14 Apr 1999 11:28:18 -0400
Subject: forking + stdout = confusion
References: <RUgQ2.31$Oq4.32657@newsfeed.avtel.net> <87n20caldg.fsf@spock.localnet.de> <roy-1304991155360001@qwerky.med.nyu.edu> <ne2R2.33$xa5.26667@newsfeed.avtel.net>
Message-ID: <roy-1404991128180001@qwerky.med.nyu.edu>
X-UID: 314                                                  

clarence at silcom.com (Clarence Gardner) wrote:
> That does indeed do the trick, but you probably had to os.close(2) also.
> (Both stdout and stderr normally are piped into Apache.)

I don't know how all Apaches work, but at least on our machine, cgis get
pipes for stdin and stdout, but stderr is connected directly to the error
log file.  I wrote a little test cgi which is just:

> #!/bin/sh
> sleep 300

opened http://my.host.name/cgi-bin/roy/sleeper.cgi and ran lsof, which is
a neat utility which mucks about in the kernel's file tables and shows you
what files a process has open.  I got:

COMMAND     PID   USER   FD   TYPE      DEVICE SIZE/OFF  NODE NAME   
sleep     25247 nobody    0r  FIFO  0x04a6ff00        0 22787
sleep     25247 nobody    1w  FIFO  0x04096e00        0 22788
sleep     25247 nobody    2w  VREG 3049,395040  4420204    90
/www/logs/error_log

-- 
Roy Smith <roy at popmail.med.nyu.edu>
New York University School of Medicine





