]> git.pld-linux.org Git - packages/apache1.git/blame_incremental - apache1.init
rel 15; builds
[packages/apache1.git] / apache1.init
... / ...
CommitLineData
1#!/bin/sh
2#
3# apache Apache Web Server
4#
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: apache
9# pidfile: /var/run/apache.pid
10# config: /etc/apache/apache.conf
11
12
13# Source function library
14. /etc/rc.d/init.d/functions
15
16# Get network config
17. /etc/sysconfig/network
18
19# Get service config
20[ -f /etc/sysconfig/apache ] && . /etc/sysconfig/apache
21
22# Check that networking is up.
23if is_yes "${NETWORKING}"; then
24 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
25 msg_network_down "Apache 1.3 Web Server"
26 exit 1
27 fi
28else
29 exit 0
30fi
31
32if is_no "${IPV6_NETWORKING}"; then
33 HTTPD_OPTS="$HTTPD_OPTS -4"
34fi
35
36configtest() {
37 /usr/sbin/apache -t
38}
39
40# wrapper for configtest
41checkconfig() {
42 local details=${1:-0}
43
44 if [ $details = 1 ]; then
45 # run config test and display report (status action)
46 show "Checking %s configuration" "Apache 1.3 Web Server"; busy
47 local out
48 out=`configtest 2>&1`
49 RETVAL=$?
50 if [ $RETVAL = 0 ]; then
51 ok
52 else
53 fail
54 fi
55 [ "$out" ] && echo >&2 "$out"
56 else
57 # run config test and abort with nice message if failed
58 # (for actions checking status before action).
59 configtest >/dev/null 2>&1
60 RETVAL=$?
61 if [ $RETVAL != 0 ]; then
62 show "Checking %s configuration" "Apache 1.3 Web Server"; fail
63 nls 'Configuration test failed. See details with %s "checkconfig"' $0
64 exit $RETVAL
65 fi
66 fi
67}
68
69start() {
70 # Check if the service is already running?
71 if [ -x /usr/lib/apache1/lingerd ]; then
72 if [ ! -f /var/lock/subsys/lingerd ]; then
73 msg_starting "Apache Lingerd"
74 SERVICE_UMASK=002 daemon --user http /usr/lib/apache1/lingerd
75 RETVAL=$?
76 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/lingerd
77 else
78 msg_already_running "Apache Lingerd"
79 fi
80 fi
81
82 if [ -f /var/lock/subsys/apache ]; then
83 msg_already_running "Apache 1.3 Web Server"
84 return
85 fi
86
87 checkconfig
88 msg_starting "Apache 1.3 Web Server"
89 daemon /usr/sbin/apache $HTTPD_OPTS
90 RETVAL=$?
91 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/apache
92}
93
94stop() {
95 # Stop daemons.
96 if [ -f /var/lock/subsys/apache ]; then
97 msg_stopping "Apache 1.3 Web Server"
98 killproc --pidfile /var/run/apache.pid apache
99 rm -f /var/lock/subsys/apache /var/run/apache.pid /var/run/apache.loc* >/dev/null 2>&1
100 else
101 msg_not_running "Apache 1.3 Web Server"
102 fi
103 if [ -x /usr/lib/apache1/lingerd ]; then
104 if [ -f /var/lock/subsys/lingerd ]; then
105 msg_stopping "Apache Lingerd"
106 /usr/lib/apache1/lingerd -k && ok || fail
107 rm -f /var/lock/subsys/lingerd >/dev/null 2>&1
108 else
109 msg_not_running "Apache Lingerd"
110 fi
111 fi
112}
113
114reload() {
115 local sig=${1:-HUP}
116 local retnr=${2:-7}
117 if [ ! -f /var/lock/subsys/apache ]; then
118 msg_not_running "Apache 1.3 Web Server"
119 RETVAL=$retnr
120 return
121 fi
122
123 checkconfig
124 msg_reloading "Apache 1.3 Web Server"
125 killproc --pidfile /var/run/apache.pid apache -$sig
126 RETVAL=$?
127}
128
129condrestart() {
130 if [ ! -f /var/lock/subsys/apache ]; then
131 msg_not_running "Apache 1.3 Web Server"
132 RETVAL=$1
133 return
134 fi
135
136 checkconfig
137 stop
138 start
139}
140
141RETVAL=0
142# See how we were called.
143case "$1" in
144 start)
145 start
146 ;;
147 stop)
148 stop
149 ;;
150 restart)
151 checkconfig
152 stop
153 start
154 ;;
155 try-restart)
156 condrestart 0
157 ;;
158 reload|graceful)
159 reload USR1 7
160 ;;
161 force-reload)
162 reload HUP 7
163 ;;
164 flush-logs)
165 reload USR1 0
166 ;;
167 checkconfig|configtest)
168 checkconfig 1
169 ;;
170 status)
171 status apache
172 RETVAL=$?
173 /usr/sbin/apache -S
174 ;;
175 *)
176 msg_usage "$0 {start|stop|restart|try-restart|reload|graceful|force-reload|checkconfig|status}"
177 exit 3
178 ;;
179esac
180
181exit $RETVAL
This page took 0.026881 seconds and 5 git commands to generate.