New init.d httpd boot script 2.7

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
9,158
We're currently testing a new init.d boot script for Apache (it's not for systemd boxes)
http://files1.directadmin.com/services/custombuild/httpd_2-2.7

It now uses apachectl for restarts, and "httpd -k stop" for a full stop.
The purpose was to try and mitigate semaphore issues which are randomly occurring with the 2.6 script

We have been running this for about a week on our live test box without issue.
We're looking for anyone willing to try it out, to test it and let us know how it goes.
If you're having semaphore issues and regularly having to purge them with ipcs, then this is going to be a recommended fix to try.

For init.d based systems.. first confirm you are not using systemd:
Code:
/usr/local/directadmin/directadmin c | grep systemd
and make sure it shows
Code:
systemd=0
If it shows systemd=1 then this is NOT for you. Only install it if you see systemd=0.

To install, run:
Code:
wget -O /etc/init.d/httpd http://files1.directadmin.com/services/custombuild/httpd_2-2.7
and test with full:
Code:
service httpd restart

service httpd stop

service httpd start

service httpd reload

service httpd graceful
Without doing a copy/paste of all commands at the same time.
Run them one at a time, and confirm your websites are working between each one.

It's normal to see the "Found 1 leftover httpd processes. Killing." message.. which code we may remove in case it's a factor to the semaphore issue (killing httpd before it fully stopped). It was added for cases where you could end up with a ghosted httpd process. In theory, the httpd -k calls (apachectl) should handle that for gracefully, preventing it in the first place.

My main concern is that the httpd restart, which now called "httpd -k restart" does not kill the main root httpd process, and continue to use the same PID.
Confirming that adding SSL certificates, or adding/removing domains fully loads/removes the new VirtualHosts... and properly re-opens logs, is what we're after.

Full diff is below:
Code:
[root@files1 custombuild]# diff -u httpd_2-2.6 httpd_2-2.7
--- httpd_2-2.6 2017-03-19 20:00:31.000000000 -0500
+++ httpd_2-2.7 2018-05-05 21:17:55.000000000 -0500
@@ -1,5 +1,5 @@
 #!/bin/bash
-#VERSION=2.6
+#VERSION=2.7
 #
 # httpd        Startup script for the Apache HTTP Server
 #
@@ -64,7 +64,7 @@
 # httpd parent to SIGKILL any errant children.
 stop() {
        echo -n $"Stopping $prog: "
-       killproc -p ${pidfile} -d ${STOP_TIMEOUT} $httpd
+       $httpd -k stop
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
@@ -106,10 +106,6 @@
         status -p ${pidfile} $httpd
        RETVAL=$?
        ;;
-  restart)
-       stop
-       start
-       ;;
   condrestart|try-restart)
        if status -p ${pidfile} $httpd >&/dev/null; then
                stop
@@ -119,7 +115,7 @@
   force-reload|reload)
         reload
        ;;
-  graceful|help|configtest|fullstatus)
+  restart|graceful|help|configtest|fullstatus)
        $apachectl $@
        RETVAL=$?
        ;;

After confirmation of testing and and sufficient period of time , I'll swap the symbolic link:
http://files1.directadmin.com/services/custombuild/httpd_2

from 2.6 to be 2.7. As httpd boot scripts are vital, this won'e be a premature push.

Thanks!
John
 
Back
Top