Re: Accessing Apache master process pid

2002-03-26 Thread Jon Jensen

On Wed, 20 Mar 2002, Geoffrey Young wrote:

   Jon Jensen wrote:
   
Within mod_perl, I would like to know the pid of the master Apache daemon,
 
 well, here's one other way:
 
 Perl
   $Apache::Server::SaveConfig = 1;
   $PidFile = 'logs/httpd.pid';
 /Perl
 
 PerlInitHandler 'sub { warn The parent pid file is: , \
shift-server_root_relative($Apache::ReadConfig::PidFile)}'
 
 yeilds:
 The parent pid file is: /usr/local/apache/logs/httpd.pid at (eval 312)
 line 1.
 
 if you really need access to ap_pid_fname() that looks easy enough,
 but justification for needing it would help doug make the
 architectural decision whether to include it or not in core.

My main motivation is the Don't Repeat Yourself principle -- I'd like to 
be able to find out the name of the pidfile without duplicating its name 
and location anywhere in the configuration, and since Apache already knows 
it, I can't think of a reason mod_perl shouldn't expose it.

But either way, life will go on. :)

Jon




Accessing Apache master process pid

2002-03-19 Thread Jon Jensen

Forgive me if this is really elementary.

Within mod_perl, I would like to know the pid of the master Apache daemon,
*after* it forks and goes into the background, but without knowing the
location of httpd.conf or knowing the pidfile beforehand. Storing $$
during startup gives me the pid before forking (i.e., on an idle Linux
system it's usually 2 lower than the pid of the actual daemon). Checking 
$$ in the children is of course not useful.

It seems like I could do one of the following:

1. Just ask some secret Apache routine to give me the number. I haven't 
found such a routine.

2. Find a way to access Apache globals such as char *ap_pid_fname, then 
read the file. This would be fine.

3. Snag the PidFile directive during startup time.

But I haven't found a way to do any of those so far. Most access to pids
seems centered on child pids, while the master pid seems totally
unavailable. (Apache::Scoreboard, for example.)

Does anyone know of a nice way to do this?

Thanks,
Jon




Re: Accessing Apache master process pid

2002-03-19 Thread Jon Jensen

On Wed, 20 Mar 2002, Stas Bekman wrote:

 Jon Jensen wrote:
  
  Within mod_perl, I would like to know the pid of the master Apache daemon,
 
 perldoc -f getppid

Thanks, Stas. I should've found that. I'm still interested in getting the 
PidFile setting at runtime, but can live without it if I have to.

Jon