--- httpd_2	2016-04-30 16:46:55.000000000 -0500
+++ httpd_2.old.2	2016-05-01 01:39:30.000000000 -0500
@@ -1,49 +1,52 @@
 #!/bin/bash
 #
-# httpd        Startup script for the Apache HTTP Server
+# Startup script for the Apache Web Server
 #
 # chkconfig: - 85 15
-# description: The Apache HTTP Server is an efficient and extensible  \
-#	       server implementing the current HTTP standards.
+# description: Apache is a World Wide Web server.  It is used to serve \
+#	       HTML files and CGI.
 # processname: httpd
-# config: /etc/httpd/conf/httpd.conf
-# config: /etc/sysconfig/httpd
 # pidfile: /var/run/httpd.pid
-#
-### BEGIN INIT INFO
-# Provides: httpd
-# Required-Start: $local_fs $remote_fs $network $named
-# Required-Stop: $local_fs $remote_fs $network
-# Should-Start: distcache
-# Short-Description: start and stop Apache HTTP Server
-# Description: The Apache HTTP Server is an extensible server 
-#  implementing the current HTTP standards.
-### END INIT INFO
+# config: /etc/httpd/conf/access.conf
+# config: /etc/httpd/conf/httpd.conf
+# config: /etc/httpd/conf/srm.conf
 
 ulimit -HSn 32768
 
 # Source function library.
 . /etc/rc.d/init.d/functions
 
-# Start httpd in the C locale by default.
-HTTPD_LANG=${HTTPD_LANG-"C"}
-
 # This will prevent initlog from swallowing up a pass-phrase prompt if
 # mod_ssl needs a pass-phrase from the user.
 INITLOG_ARGS=""
 
-# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
-# with the thread-based "worker" MPM; BE WARNED that some modules may not
-# work correctly with a thread-based MPM; notably PHP will refuse to start.
-
 # Path to the apachectl script, server binary, and short-form for messages.
 apachectl=/usr/sbin/apachectl
-httpd=${HTTPD-/usr/sbin/httpd}
+httpd=/usr/sbin/httpd
 prog=httpd
-pidfile=${PIDFILE-/var/run/httpd.pid}
-lockfile=${LOCKFILE-/var/lock/subsys/httpd}
 RETVAL=0
-STOP_TIMEOUT=${STOP_TIMEOUT-10}
+
+
+PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/etc/domeny:/etc/local/bin:.:$PATH
+ENV="env -i LANG=C PATH=/usr/local/bin:/usr/bin:/bin LC_MESSAGES=en_US"
+
+# check for 1.3 configuration
+check13 () {
+	CONFFILE=/etc/httpd/conf/httpd.conf
+	GONE="(ServerType|BindAddress|Port|AddModule|ClearModuleList|"
+	GONE="${GONE}AgentLog|RefererLog|RefererIgnore|FancyIndexing|"
+	GONE="${GONE}AccessConfig|ResourceConfig)"
+	if grep -Eiq "^[[:space:]]*($GONE)" $CONFFILE; then
+		echo
+		echo 1>&2 " Apache 1.3 configuration directives found"
+		echo 1>&2 " please read @docdir@/migration.html"
+		failure "Apache 1.3 config directives test"
+		echo
+		exit 1
+	fi
+}
+
+
 
 # The semantics of these two functions differ from the way apachectl does
 # things -- attempting to start while running is a failure, and shutdown
@@ -51,38 +54,46 @@
 # are expected to behave here.
 start() {
         echo -n $"Starting $prog: "
-        LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
+	check13 || exit 1
+        $ENV $httpd -k start -DSSL
         RETVAL=$?
         echo
-        [ $RETVAL = 0 ] && touch ${lockfile}
+        [ $RETVAL = 0 ] && touch /var/lock/subsys/httpd
         return $RETVAL
 }
-
-# When stopping httpd, a delay (of default 10 second) is required
-# before SIGKILLing the httpd parent; this gives enough time for the
-# httpd parent to SIGKILL any errant children.
 stop() {
 	echo -n $"Stopping $prog: "
-	killproc -p ${pidfile} -d ${STOP_TIMEOUT} $httpd
+	killproc $httpd
 	RETVAL=$?
 	echo
-	[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
+	[ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd /var/run/httpd.pid
+}
+waitforexit() {
+	count=${2:-30}
+	while [ 0$count -gt 0 ]
+	do
+		PIDS=`ps -C$prog --no-heading e | grep $httpd` || break
+		PIDS=`echo "$PIDS" | awk '{print $1}' | tr '\n' ' '`
+		echo Remaining processes: $PIDS
+		stop
+		sleep 2
+		count=`expr $count - 1`
+	done
+	if [ 0$count -eq 0 ];
+	then
+		echo Remaining processes: $PIDS
+		return 1
+	fi
+	return 0
 }
+
+
 reload() {
-    echo -n $"Reloading $prog: "
-    if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
-        RETVAL=6
-        echo $"not reloading due to configuration syntax error"
-        failure $"not reloading $httpd due to configuration syntax error"
-    else
-        # Force LSB behaviour from killproc
-        LSB=1 killproc -p ${pidfile} $httpd -HUP
-        RETVAL=$?
-        if [ $RETVAL -eq 7 ]; then
-            failure $"httpd shutdown"
-        fi
-    fi
-    echo
+	echo -n $"Reloading $prog: "
+	check13 || exit 1
+	killproc $httpd -HUP
+	RETVAL=$?
+	echo
 }
 
 # See how we were called.
@@ -94,20 +105,21 @@
 	stop
 	;;
   status)
-        status -p ${pidfile} $httpd
+        status $httpd
 	RETVAL=$?
 	;;
   restart)
 	stop
+	waitforexit "httpd" 20
 	start
 	;;
-  condrestart|try-restart)
-	if status -p ${pidfile} $httpd >&/dev/null; then
+  condrestart)
+	if [ -f /var/run/httpd.pid ] ; then
 		stop
 		start
 	fi
 	;;
-  force-reload|reload)
+  reload)
         reload
 	;;
   graceful|help|configtest|fullstatus)
@@ -115,8 +127,8 @@
 	RETVAL=$?
 	;;
   *)
-	echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest}"
-	RETVAL=2
+	echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
+	exit 1
 esac
 
 exit $RETVAL
