Subversion Repositories configs

Rev

Rev 4 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 - 1
#!/bin/bash
2
#
3
# httpd        Startup script for the Apache HTTP Server
4
#
5
# chkconfig: - 85 15
6
# description: The Apache HTTP Server is an efficient and extensible  \
7
#	       server implementing the current HTTP standards.
8
# processname: httpd
9
# config: /etc/httpd/conf/httpd.conf
10
# config: /etc/sysconfig/httpd
11
# pidfile: /var/run/httpd/httpd.pid
12
#
13
### BEGIN INIT INFO
14
# Provides: httpd
15
# Required-Start: $local_fs $remote_fs $network $named
16
# Required-Stop: $local_fs $remote_fs $network
17
# Should-Start: distcache
18
# Short-Description: start and stop Apache HTTP Server
19
# Description: The Apache HTTP Server is an extensible server
20
#  implementing the current HTTP standards.
21
### END INIT INFO
22
 
23
# Source function library.
24
. /etc/rc.d/init.d/functions
25
 
26
if [ -f /etc/sysconfig/httpd ]; then
27
        . /etc/sysconfig/httpd
28
fi
29
 
30
# Start httpd in the C locale by default.
31
HTTPD_LANG=${HTTPD_LANG-"C"}
32
 
33
# This will prevent initlog from swallowing up a pass-phrase prompt if
34
# mod_ssl needs a pass-phrase from the user.
35
INITLOG_ARGS=""
36
 
37
# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
38
# with the thread-based "worker" MPM; BE WARNED that some modules may not
39
# work correctly with a thread-based MPM; notably PHP will refuse to start.
40
 
41
# Path to the apachectl script, server binary, and short-form for messages.
42
apachectl=/usr/sbin/apachectl
43
httpd=${HTTPD-/usr/sbin/httpd}
44
prog=httpd
45
pidfile=${PIDFILE-/var/run/httpd/httpd.pid}
46
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
47
RETVAL=0
48
STOP_TIMEOUT=${STOP_TIMEOUT-10}
49
 
50
# The semantics of these two functions differ from the way apachectl does
51
# things -- attempting to start while running is a failure, and shutdown
52
# when not running is also a failure.  So we just do it the way init scripts
53
# are expected to behave here.
54
start() {
55
        echo -n $"Starting $prog: "
56
        LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
57
        RETVAL=$?
58
        echo
59
        [ $RETVAL = 0 ] && touch ${lockfile}
60
        return $RETVAL
61
}
62
 
63
# When stopping httpd, a delay (of default 10 second) is required
64
# before SIGKILLing the httpd parent; this gives enough time for the
65
# httpd parent to SIGKILL any errant children.
66
stop() {
58 - 67
	status -p ${pidfile} $httpd > /dev/null
68
	if [[ $? = 0 ]]; then
69
		echo -n $"Stopping $prog: "
70
		killproc -p ${pidfile} -d ${STOP_TIMEOUT} $httpd
71
	else
72
		echo -n $"Stopping $prog: "
73
		success
74
	fi
4 - 75
	RETVAL=$?
76
	echo
77
	[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
78
}
58 - 79
 
4 - 80
reload() {
81
    echo -n $"Reloading $prog: "
82
    if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
83
        RETVAL=6
84
        echo $"not reloading due to configuration syntax error"
85
        failure $"not reloading $httpd due to configuration syntax error"
86
    else
87
        # Force LSB behaviour from killproc
88
        LSB=1 killproc -p ${pidfile} $httpd -HUP
89
        RETVAL=$?
90
        if [ $RETVAL -eq 7 ]; then
91
            failure $"httpd shutdown"
92
        fi
93
    fi
94
    echo
95
}
96
 
97
# See how we were called.
98
case "$1" in
99
  start)
100
	start
101
	;;
102
  stop)
103
	stop
104
	;;
105
  status)
106
        status -p ${pidfile} $httpd
107
	RETVAL=$?
108
	;;
109
  restart)
110
	stop
111
	start
112
	;;
113
  condrestart|try-restart)
114
	if status -p ${pidfile} $httpd >&/dev/null; then
115
		stop
116
		start
117
	fi
118
	;;
119
  force-reload|reload)
120
        reload
121
	;;
122
  graceful|help|configtest|fullstatus)
123
	$apachectl $@
124
	RETVAL=$?
125
	;;
126
  *)
127
	echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest}"
128
	RETVAL=2
129
esac
130
 
131
exit $RETVAL