]> git.pld-linux.org Git - packages/apache.git/blobdiff - apache1.init
- run lingerd with umask 002, so that apache main uid could differ from PLD default
[packages/apache.git] / apache1.init
index 8edad64d1810bdfb956355e89d876dbdcb2866a5..55f0f3eac778e6fb3967776c6b18b90bf2c35ee9 100644 (file)
@@ -39,11 +39,21 @@ RETVAL=0
 case "$1" in
   start)
        # Check if the service is already running?
+       if [ -x /usr/lib/apache1/lingerd ]; then
+               if [ ! -f /var/lock/subsys/lingerd ]; then
+                       msg_starting lingerd
+                       SERVICE_UMASK=002 daemon --user http /usr/lib/apache1/lingerd
+                       RETVAL=$?
+                       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/lingerd
+               else
+                       msg_already_running lingerd
+               fi
+       fi
        if [ ! -f /var/lock/subsys/apache ]; then
                msg_starting apache
                daemon apache $HTTPD_OPTS
                RETVAL=$?
-               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/apache
+               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/apache
        else
                msg_already_running apache
        fi
@@ -53,10 +63,19 @@ case "$1" in
        if [ -f /var/lock/subsys/apache ]; then
                msg_stopping apache
                killproc apache
-               rm -f /var/lock/subsys/apache /var/run/.pid /var/run/apache.loc* >/dev/null 2>&1
+               rm -f /var/lock/subsys/apache /var/run/apache.pid /var/run/apache.loc* >/dev/null 2>&1
        else
                msg_not_running apache
        fi
+       if [ -x /usr/lib/apache1/lingerd ]; then
+               if [ -f /var/lock/subsys/lingerd ]; then
+                       msg_stopping lingerd
+                       /usr/lib/apache1/lingerd -k && ok || fail
+                       rm -f /var/lock/subsys/lingerd >/dev/null 2>&1
+               else
+                       msg_not_running lingerd
+               fi
+       fi
        ;;
   status)
        status apache
@@ -64,15 +83,31 @@ case "$1" in
        /usr/sbin/apache -S
        ;;
   restart)
-       $0 stop
-       $0 start
-       exit $?
+       apache -t > /dev/null 2>&1
+       RETVAL=$?
+       if [ $RETVAL -eq 0 ]; then
+               $0 stop
+               RETVAL=$((RETVAL + $?))
+               $0 start
+               RETVAL=$((RETVAL + $?))
+       else
+               fail
+               echo "Configuration file syntax test failed."
+       fi
+
        ;;
   reload|force-reload)
        if [ -f /var/lock/subsys/apache ]; then
                msg_reloading apache
-               killproc apache -HUP
+
+               apache -t > /dev/null 2>&1
                RETVAL=$?
+               if [ $RETVAL -eq 0 ]; then
+                       killproc apache -HUP
+               else
+                       fail
+                       echo "Configuration file syntax test failed."
+               fi
        else
                msg_not_running apache >&2
                RETVAL=7
@@ -81,15 +116,25 @@ case "$1" in
   graceful)
        if [ -f /var/lock/subsys/apache ]; then
                msg_reloading apache
-               killproc apache -USR1
+
+               apache -t > /dev/null 2>&1
                RETVAL=$?
-        else
+               if [ $RETVAL -eq 0 ]; then
+                       killproc apache -USR1
+               else
+                       fail
+                       echo "Configuration file syntax test failed."
+               fi
+       else
                msg_not_running apache >&2
                RETVAL=7
        fi
        ;;
+  configtest)
+       apache -t
+       ;;
   *)
-       msg_usage "$0 {start|stop|restart|reload|force-reload|graceful|status}"
+       msg_usage "$0 {start|stop|restart|reload|force-reload|graceful|configtest|status}"
        exit 3
        ;;
 esac
This page took 0.031053 seconds and 4 git commands to generate.