HTTPD_OPTS="$HTTPD_OPTS -4"
fi
-RETVAL=0
-# See how we were called.
-case "$1" in
- start)
+configtest() {
+ apache -t > /dev/null 2>&1
+ RETVAL=$?
+}
+
+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
- ;;
- status)
- status apache
- RETVAL=$?
- /usr/sbin/apache -S
- ;;
- restart)
- apache -t > /dev/null 2>&1
- RETVAL=$?
+}
+
+restart() {
+ configtest
if [ $RETVAL -eq 0 ]; then
- $0 stop
- RETVAL=$((RETVAL + $?))
- $0 start
- RETVAL=$((RETVAL + $?))
+ stop
+ start
else
fail
- echo "Configuration file syntax test failed."
+ echo >&2 "Configuration file syntax test failed."
fi
+}
- ;;
- reload|force-reload)
- if [ -f /var/lock/subsys/apache ]; then
+reload() {
+ sig=${1:-HUP}
+ retnr=${2:-7}
+ if [ -f /var/lock/subsys/apache ]; then
msg_reloading apache
- apache -t > /dev/null 2>&1
- RETVAL=$?
+ configtest
if [ $RETVAL -eq 0 ]; then
- killproc apache -HUP
+ killproc apache -$sig
+ RETVAL=$?
else
fail
- echo "Configuration file syntax test failed."
+ echo >&2 "Configuration file syntax test failed."
fi
else
- msg_not_running apache >&2
- RETVAL=7
+ msg_not_running apache
+ RETVAL=$retnr
fi
- ;;
- graceful)
- if [ -f /var/lock/subsys/apache ]; then
- msg_reloading apache
+}
- apache -t > /dev/null 2>&1
- RETVAL=$?
- if [ $RETVAL -eq 0 ]; then
- killproc apache -USR1
- else
- fail
- echo "Configuration file syntax test failed."
- fi
+RETVAL=0
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ status apache
+ RETVAL=$?
+ /usr/sbin/apache -S
+ ;;
+ restart)
+ restart
+ ;;
+ try-restart)
+ if [ -f /var/lock/subsys/apache ]; then
+ restart
else
- msg_not_running apache >&2
- RETVAL=7
+ msg_not_running apache
fi
;;
+ force-reload)
+ reload HUP 7
+ ;;
+ reload|graceful)
+ reload USR1 7
+ ;;
+ flush-logs)
+ reload USR1 0
+ ;;
configtest)
apache -t
;;
*)
- msg_usage "$0 {start|stop|restart|reload|force-reload|graceful|configtest|status}"
+ msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|graceful|configtest|status}"
exit 3
;;
esac