# Check that networking is up.
if is_yes "${NETWORKING}"; then
if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
- # nls "ERROR: Networking is down. %s can't be run." <service>
msg_network_down apache
exit 1
fi
HTTPD_OPTS="$HTTPD_OPTS -4"
fi
-RETVAL=0
-# See how we were called.
-case "$1" in
- start)
+configtest() {
+ apache -t > /dev/null 2>&1
+}
+
+start() {
# Check if the service is already running?
if [ -x /usr/lib/apache1/lingerd ]; then
if [ ! -f /var/lock/subsys/lingerd ]; then
else
msg_already_running apache
fi
- ;;
- stop)
+}
+
+stop() {
# Stop daemons.
if [ -f /var/lock/subsys/apache ]; then
msg_stopping apache
msg_not_running lingerd
fi
fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
;;
status)
status apache
apache -t > /dev/null 2>&1
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
- $0 stop
- RETVAL=$((RETVAL + $?))
- $0 start
- RETVAL=$((RETVAL + $?))
+ stop
+ start
else
fail
echo "Configuration file syntax test failed."
fi
;;
- reload|force-reload)
+ force-reload)
if [ -f /var/lock/subsys/apache ]; then
msg_reloading apache
- apache -t > /dev/null 2>&1
+ configtest
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
killproc apache -HUP
echo "Configuration file syntax test failed."
fi
else
- msg_not_running apache >&2
+ msg_not_running apache
RETVAL=7
fi
;;
- graceful)
+ reload|graceful)
if [ -f /var/lock/subsys/apache ]; then
msg_reloading apache
- apache -t > /dev/null 2>&1
+ configtest
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
killproc apache -USR1
else
fail
- echo "Configuration file syntax test failed."
+ echo >&2 "Configuration file syntax test failed."
fi
else
- msg_not_running apache >&2
+ msg_not_running apache
RETVAL=7
fi
;;
+ flush-logs)
+ if [ -f /var/lock/subsys/apache ]; then
+ msg_reloading apache
+
+ configtest
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ]; then
+ killproc apache -USR1
+ RETVAL=$?
+ else
+ fail
+ echo >&2 "Configuration file syntax test failed."
+ fi
+ fi
+ ;;
configtest)
apache -t
;;