]> git.pld-linux.org Git - packages/apache.git/blame - apache.init
- fixed the "unable to bind socket problem"
[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
22[ -f /etc/sysconfig/apache ] && . /etc/sysconfig/apache
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 # nls "ERROR: Networking is down. %s can't be run." <service>
28 msg_network_down httpd
29 exit 1
30 fi
31else
32 exit 0
036261c0 33fi
1f86fa83 34
7728b647
AM
35[ -z "$HTTPD_MPM" ] && HTTPD_MPM="prefork"
36
e156d1e7 37RETVAL=0
58f9559b
AF
38# See how we were called.
39case "$1" in
40 start)
34c86420 41 # Check if the service is already running?
a7f729cf 42 if [ ! -f /var/lock/subsys/httpd ]; then
7728b647 43 msg_starting httpd.${HTTPD_MPM}
5bd16c4e 44 daemon httpd.${HTTPD_MPM} -f /etc/httpd/httpd.conf $HTTPD_OPTS
a7f729cf 45 RETVAL=$?
46 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/httpd
34c86420 47 else
7728b647 48 msg_already_running httpd.${HTTPD_MPM}
34c86420 49 fi
58f9559b
AF
50 ;;
51 stop)
a7f729cf 52 # Stop daemons.
a4aad8e2 53 if [ -f /var/lock/subsys/httpd ]; then
7728b647 54 msg_stopping httpd.${HTTPD_MPM}
5bd16c4e 55 daemon httpd.${HTTPD_MPM} -f /etc/httpd/httpd.conf -k stop
a7f729cf 56 rm -f /var/lock/subsys/httpd /var/run/httpd.pid /var/run/httpd.loc* >/dev/null 2>&1
b1b975ba 57 # Wait for the process to end. Int prevents "unable to bind socket error"
58 sleep 3
a7f729cf 59 else
7728b647 60 msg_not_running httpd.${HTTPD_MPM}
a4aad8e2 61 fi
58f9559b
AF
62 ;;
63 status)
7728b647 64 status httpd.${HTTPD_MPM}
b3d1e4ee 65 RETVAL=$?
5bd16c4e 66 /usr/sbin/httpd.${HTTPD_MPM} -f /etc/httpd/httpd.conf -S
58f9559b 67 ;;
40350f98 68 restart)
f9712db9 69 $0 stop
58f9559b
AF
70 $0 start
71 ;;
f9712db9 72 reload|force-reload|graceful)
e156d1e7 73 if [ -f /var/lock/subsys/httpd ]; then
7728b647 74 msg_reloading httpd.${HTTPD_MPM}
5bd16c4e 75 daemon httpd.${HTTPD_MPM} -f /etc/httpd/httpd.conf -k graceful
e156d1e7 76 RETVAL=$?
77 else
7728b647 78 msg_not_running httpd.${HTTPD_MPM} >&2
e156d1e7 79 RETVAL=7
80 fi
40350f98 81 ;;
58f9559b 82 *)
62c5d063 83 msg_usage "$0 {start|stop|restart|reload|force-reload|graceful|status}"
e156d1e7 84 exit 3
58f9559b
AF
85 ;;
86esac
87
a4aad8e2 88exit $RETVAL
This page took 0.043881 seconds and 4 git commands to generate.