On Thu, 11 Mar 2010, Gilles Chehade wrote:

> On Thu, Mar 11, 2010 at 03:20:33PM +0100, Antoine Jacoutot wrote:
> > On Thu, 11 Mar 2010, Ozgur Kazancci wrote:
> > 
> > > When apachectl issuing a restart, it sends a SIGHUP signal to httpd,
> > > and when httpd receives this signal, it doesn't exit from its chroot.
> > > So, "apachectl restart" becomes unfunctional when you have external
> > > modules via LoadModule in your httpd.conf.
> > > 
> > > I have the following line in my httpd.conf:
> > > 
> > > LoadModule throttle_module  /usr/lib/apache/modules/mod_throttle.so
> > > 
> > > When you have such a line, (and the module file exists there) apache
> > > doesn't want to restart (apachectl restart) anymore.
> > 
> > Oh common, at least read the apachectl(8) man page.
> > 
> 
> or the FAQ ...

Is this something utterly stupid?

just wasting some time...
david

--- apachectl.orig      Wed Mar  3 23:20:53 2010
+++ apachectl           Thu Mar 11 20:11:31 2010
@@ -27,6 +27,9 @@
 # the path to your httpd binary, including options if necessary
 HTTPD=/usr/sbin/httpd
 #
+# the path to your httpd configuration file
+CONFIGFILE=/var/www/conf/httpd.conf
+#
 # a command that outputs a formatted text version of the HTML at the
 # url given on the command line.  Designed for lynx, however other
 # programs may work.  
@@ -116,11 +119,19 @@
            fi
        else
            if $HTTPD $RCFLAGS -t >/dev/null 2>&1; then
-               if kill -HUP $PID ; then
-                   echo "$0 $ARG: httpd restarted"
+               if ps ax | grep $PID | grep chroot >/dev/null && \
+                       egrep '^ *LoadModule' $CONFIGFILE >/dev/null
+               then
+                   echo "$0 $ARG: httpd chrooted with external modules"
+                   echo "$0 $ARG: trying stop/start"
+                   $0 stop && sleep 2 && $0 start
                else
-                   echo "$0 $ARG: httpd could not be restarted"
-                   ERROR=6
+                   if kill -HUP $PID ; then
+                       echo "$0 $ARG: httpd restarted"
+                   else
+                       echo "$0 $ARG: httpd could not be restarted"
+                       ERROR=6
+                   fi
                fi
            else
                echo "$0 $ARG: configuration broken, ignoring restart"

Reply via email to