Acked.
----- Forwarded message from "Andrei B." <[EMAIL PROTECTED]> -----
From: "Andrei B." <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Fwd: apachectl script FIX
Date: Thu, 28 Jun 2001 00:00:06 -0700 (PDT)
I received no acknowledgement for this message.
Please acknowledge.
--- "Andrei B." <[EMAIL PROTECTED]> wrote:
> Date: Tue, 5 Jun 2001 00:25:58 -0700 (PDT)
> From: "Andrei B." <[EMAIL PROTECTED]>
> Subject: apachectl script FIX
> To: [EMAIL PROTECTED]
>
> Hello, Apache Team,
>
> The control script "apachectl" by Marc Slemko inspired me for a
> similar script for the squid proxy server.
> After I posted the script on the squid mailing list, Colin Campbell
> pointed to me that the script made a few assumptions that could lead
> to
> a wrong conclusion.
>
> apachectl from Slackware Linux 7.0 (Server version: Apache/1.3.9
> (Unix))
> === Lines 50 through 63 ==========================
> # check for pidfile
> if [ -f $PIDFILE ] ; then
> PID=`cat $PIDFILE`
> if [ "x$PID" != "x" ] && 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"
> RUNNING=0
> fi
>
=======================================================================
>
> As pointed out by Colin Campbell, this code assumes that if a PID
> file
> exists, it contains a PID number and a process is running with that
> PID, then apache (in my case squid) is running. This assumption may
> be
> false.
>
> Replace lines 50 through 63 with the following :
>
=======================================================================
> # check for pid file
> if [ -f $PIDFILE ]; then # PID file exists
> PID=`cat $PIDFILE`
> if [ "x$PID" != "x" ]; then # PID exists
> if kill -0 $PID 2>/dev/null ; then # a process using PID
> is
> running
> if ps -p $PID -o args | grep httpd > /dev/null 2>&1;
> then
> # that process is httpd itself, OK
> STATUS="httpd (pid $PID) running"
> RUNNING=1
> else
> # httpd not running, stale PID file contains PID of
> another
> # running process. No httpd, remove the PID file
> rm -f $PIDFILE
> STATUS="httpd (stale pid file removed) not
> running"
> RUNNING=0
> fi
> else
> # nothing using this PID. Remove file
> rm -f $PIDFILE
> STATUS="httpd (stale pid file removed) not running"
> RUNNING=0
> fi
> else
> # PID file is empty. httpd not running, remove file.
> rm -f $PIDFILE
> STATUS="httpd (stale pid file removed) not running"
> RUNNING=0
> fi
> else
> # No PID file, not running.
> STATUS="httpd (no pid) not running"
> RUNNING=0
> fi
>
=======================================================================
>
> My derivative for squid, called squidctl will be found on the squid
> mailing list and on my personal homepage.
> With permission from you, I would like to include this fix for
> apachectl, also.
>
> Attached is a diff file for patching apachectl directly.
> Apply with patch -p0 < apachectl.diff.
>
> --
> Andrei Boros
> Homepage : http://members.tripod.com/andrei_b
>
>
>
> =====
> ing. Andrei Boros
> Centrul pt. Tehnologia Informatiei
> Societatea Romana de Radiodifuziune
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail - only $35
> a year! http://personal.mail.yahoo.com/
> ATTACHMENT part 2 application/x-gzip name=apachectl.tar.gz
=====
ing. Andrei Boros
Centrul pt. Tehnologia Informatiei
Societatea Romana de Radiodifuziune
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/
----- End forwarded message -----
--
#ken P-)}
Ken Coar, Sanagendamgagwedweinini http://Golux.Com/coar/
Author, developer, opinionist http://Apache-Server.Com/
"All right everyone! Step away from the glowing hamburger!"