httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Slemko <ma...@worldgate.com>
Subject Re: [PATCH] avoid ps -p on SunOS
Date Thu, 04 Jun 1998 23:02:53 GMT
On Thu, 4 Jun 1998, Ben Hyde wrote:

> 
> This works on all my machines and since uname is
> used in GuessOS it seems dependable.  - ben

The problem is that there is more than just SunOS that has this problem.

I knew this was a problem when I wrote it, but there isn't a nice solution
(there was some reason I didn't use kill -0, but I am trying to remember
the details...) and -p works on the systems I care about.  <g>

> 
> > cvs diff -u apachectl
> Index: apachectl
> ===================================================================
> RCS file: /cvs/apache-1.3/src/support/apachectl,v
> retrieving revision 1.6
> diff -u -r1.6 apachectl
> --- apachectl	1998/03/31 12:53:46	1.6
> +++ apachectl	1998/06/04 21:41:46
> @@ -44,12 +44,16 @@
>      ARGS="help"
>  fi
>  
> +OSKIND=`uname`
> +PSFLAG='-p'
> +if [ "x$OSKIND" = "xSunOS" ] ; then PSFLAG=' ' ;fi
> +
>  for ARG in $@ $ARGS
>  do
>      # check for pidfile
>      if [ -f $PIDFILE ] ; then
>  	PID=`cat $PIDFILE`
> -	PS=`ps -p $PID 2>/dev/null | tail -1 | grep $PID`
> +	PS=`ps $PSFLAG $PID 2>/dev/null | tail -1 | grep $PID`
>  	if [ "x$PS" = "x" ]; then
>  	    STATUS="httpd (pid $PID?) not running"
>  	    RUNNING=0
> 


Mime
View raw message