]> git.pld-linux.org Git - packages/apache.git/blame - apache.init
- new config for apache 2.2
[packages/apache.git] / apache.init
CommitLineData
8faab90e 1#!/bin/sh
58f9559b 2#
34c86420 3# apache Apache Web Server
58f9559b 4#
34c86420 5# chkconfig: 345 85 15
6# description: Apache is a World Wide Web server. It is used to serve \
7# HTML files and CGI.
8# processname: httpd
9# pidfile: /var/run/httpd.pid
40350f98
MM
10# config: /etc/httpd/conf/access.conf
11# config: /etc/httpd/conf/httpd.conf
12# config: /etc/httpd/conf/srm.conf
34c86420 13
14
15# Source function library
58f9559b
AF
16. /etc/rc.d/init.d/functions
17
34c86420 18# Get network config
19. /etc/sysconfig/network
20
21# Get service config
9dd5ff04 22[ -f /etc/sysconfig/httpd ] && . /etc/sysconfig/httpd
34c86420 23
58f9559b 24# Check that networking is up.
a7f729cf 25if is_yes "${NETWORKING}"; then
bc107690 26 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
a7f729cf 27 msg_network_down httpd
28 exit 1
29 fi
30else
31 exit 0
036261c0 32fi
1f86fa83 33
7728b647 34[ -z "$HTTPD_MPM" ] && HTTPD_MPM="prefork"
fb55e7c8 35if [ -d "${HTTPD_CONF:-'/etc/httpd/httpd.conf'}" ]; then
e5db1e51 36 CFG="-f ${HTTPD_CONF:-'/etc/httpd/httpd.conf'}"
37elif [ -n "$HTTPD_CONF" ]; then
38 echo "error: HTTPD_CONF='$HTTPD_CONF': not a file, not a directory"
39 exit 1
812867fe 40else
cc59379f 41 CFG=""
812867fe 42fi
7728b647 43
e156d1e7 44RETVAL=0
58f9559b
AF
45# See how we were called.
46case "$1" in
47 start)
34c86420 48 # Check if the service is already running?
a7f729cf 49 if [ ! -f /var/lock/subsys/httpd ]; then
7728b647 50 msg_starting httpd.${HTTPD_MPM}
77079cb1 51 daemon httpd.${HTTPD_MPM} $CFG $HTTPD_OPTS
a7f729cf 52 RETVAL=$?
53 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/httpd
34c86420 54 else
7728b647 55 msg_already_running httpd.${HTTPD_MPM}
34c86420 56 fi
58f9559b
AF
57 ;;
58 stop)
a7f729cf 59 # Stop daemons.
a4aad8e2 60 if [ -f /var/lock/subsys/httpd ]; then
7728b647 61 msg_stopping httpd.${HTTPD_MPM}
baf2ee4d
AM
62 [ -n "$(pidofproc httpd.${HTTPD_MPM})" ] && OPT="--waitforname httpd.${HTTPD_MPM} --waitfortime 60" || OPT=
63 daemon $OPT httpd.${HTTPD_MPM} $CFG -k stop
af95835e 64 # Delete pidfile only when apache was called successfully
3a7326fb 65 if [ $? -eq 0 ]; then
af95835e 66 rm -f /var/lock/subsys/httpd /var/run/httpd.pid /var/run/httpd.loc* >/dev/null 2>&1
67 fi
a7f729cf 68 else
7728b647 69 msg_not_running httpd.${HTTPD_MPM}
a4aad8e2 70 fi
58f9559b
AF
71 ;;
72 status)
7728b647 73 status httpd.${HTTPD_MPM}
b3d1e4ee 74 RETVAL=$?
812867fe 75 /usr/sbin/httpd.${HTTPD_MPM} $CFG -S
58f9559b 76 ;;
40350f98 77 restart)
cc59379f 78 $0 stop
58f9559b
AF
79 $0 start
80 ;;
f9712db9 81 reload|force-reload|graceful)
e156d1e7 82 if [ -f /var/lock/subsys/httpd ]; then
1473e92a 83 run_cmd "Checking httpd.${HTTPD_MPM} configuration" httpd.${HTTPD_MPM} $CFG -t
df2f26df
ER
84 RETVAL=$?
85 if [ $RETVAL -eq 0 ]; then
1473e92a 86 msg_reloading httpd.${HTTPD_MPM}
fb55e7c8 87 daemon httpd.${HTTPD_MPM} $CFG -k graceful
47962253 88 RETVAL=$?
1c5fd89c 89 fi
e156d1e7 90 else
7728b647 91 msg_not_running httpd.${HTTPD_MPM} >&2
e156d1e7 92 RETVAL=7
93 fi
40350f98 94 ;;
58f9559b 95 *)
62c5d063 96 msg_usage "$0 {start|stop|restart|reload|force-reload|graceful|status}"
e156d1e7 97 exit 3
58f9559b
AF
98 ;;
99esac
100
a4aad8e2 101exit $RETVAL
This page took 0.140302 seconds and 4 git commands to generate.