On Tue, 2007-08-21 at 10:10 +0800, Mike A. wrote:

> What command should I use if I want to know what scripts or progra
> does one httpd process is running. Doing "top" and "ps -aux" command
> just give me a report that httpd processes are running but is there a
> way to know what scripts it is running? 

linuxpol suggested looking into lsof.  I looked into that and it doesn't
seem to work for, e.g., mod_php.  It might work for cgi, but I don't do
cgi anymore so someone else (possibly you :-) will have to confirm that.
Even if it works though, most scripts won't run for more than a few
seconds, so you might not be able to use lsof for that.  On my laptop,
lsof for apache2 runs for long enough that I really doubt if it could find
any script that didn't run for more than 10 seconds.  Anyway, for mod_php,
for instance, it seems that on apache2, the file is loaded, parsed, 
compiled into byte code and then closed.  so lsof won't help there since
that whole pre-processing bit generally will take fractions of a second.

The default logging setup on my apache (yours too, probably) only
logs apache requests when the request has ended.  So you won't know
that a script has run until it's finished running.  If you want to
know which scripts are running and what time they started running
(e.g., if you want to figure out which scripts take a long time,
maybe so long that the users cancel them), then you might look
into mod_log_forensic.

http://httpd.apache.org/docs/2.2/mod/mod_log_forensic.html

that's not something you'll want to log all the time, probably.
or if you do run it all the time, logrotate often.

Note: I have not actually done any of the above. I was just curious
about the question and looked around very quickly in the apache (2.2)
documentation.  So now I know something new too :-).

tiger

_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
[email protected] (#PLUG @ irc.free.net.ph)
Read the Guidelines: http://linux.org.ph/lists
Searchable Archives: http://archives.free.net.ph

Reply via email to