httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manoj Kasichainula <man...@io.com>
Subject Re: sun4 and apachectl
Date Thu, 04 Jun 1998 02:26:04 GMT
On Wed, Jun 03, 1998 at 06:01:40PM -0500, Me at IO wrote:
> On Wed, Jun 03, 1998 at 03:49:52PM -0700, Dean Gaudet wrote:
> > bind's ndc uses "ps -p $pid"... which I think is why Marc implemented
> > apachectl that way.
> > 
> > Yet another option is "kill -0 $pid".
> 
> Here's a simple patch that uses it. The kill -0 concept seems to work
> under Red Hat Linux and AIX 4.2; it's untested on the rest (notably
> sun4).

And it turns out the fix was untested anywhere, because I ran
apachectl instead of ./apachectl. Thanks to Marc for noting the
problem: the if and else blocks were switched. The concept stays the
same, though. Here's a revised patch which seems to work.

*** apachectl.orig	Wed Jun  3 21:08:28 1998
--- apachectl	Wed Jun  3 20:51:16 1998
***************
*** 49,61 ****
      # check for pidfile
      if [ -f $PIDFILE ] ; then
  	PID=`cat $PIDFILE`
! 	PS=`ps -p $PID 2>/dev/null | tail -1 | grep $PID`
! 	if [ "x$PS" = "x" ]; then
! 	    STATUS="httpd (pid $PID?) not running"
! 	    RUNNING=0
! 	else
  	    STATUS="httpd (pid $PID) running"
  	    RUNNING=1
  	fi
      else
  	STATUS="httpd (no pid file) not running"
--- 49,60 ----
      # check for pidfile
      if [ -f $PIDFILE ] ; then
  	PID=`cat $PIDFILE`
! 	if kill -0 $PID 2> /dev/null; then
  	    STATUS="httpd (pid $PID) running"
  	    RUNNING=1
+ 	else
+ 	    STATUS="httpd (pid $PID?) not running"
+ 	    RUNNING=0
  	fi
      else
  	STATUS="httpd (no pid file) not running"

Users of the Apache webserver are hereby granted a non-exclusive,
irrevocable, world-wide, royalty-free, non-transferable license to
use, execute, prepare derivative works of, and distribute (internally
and externally, and including derivative works) the code accompanying
this license as part of, and integrated into the Apache webserver.
This code is provided "AS IS" WITHOUT WARRANTY OF ANY KIND EITHER
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTY
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE
RISK ARISING OUT OF THE USE OR PERFORMANCE OF THIS CODE REMAINS WITH
USERS OF THE APACHE WEBSERVER.  I represent and warrant that I am
legally entitled to grant the above license.

-- 
Manoj Kasichainula - manojk at io dot com - http://www.io.com/~manojk/
"I am J. D. Falk, Sysadmin. I own a web-server and a LART." - Jeff Mercer

Mime
View raw message