]> git.pld-linux.org Git - packages/apache1.git/blame - apache1.init
- kill trailing spaces
[packages/apache1.git] / apache1.init
CommitLineData
0f05f0de
JB
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.
e983d4c5 8# processname: apache
9# pidfile: /var/run/apache.pid
10# config: /etc/apache/apache.conf
0f05f0de
JB
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
7c07b8e4 20[ -f /etc/sysconfig/apache1 ] && . /etc/sysconfig/apache1
0f05f0de
JB
21
22# Check that networking is up.
2b61eec8 23if is_yes "${NETWORKING}"; then
9a1f5403 24 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
2b61eec8 25 # nls "ERROR: Networking is down. %s can't be run." <service>
e983d4c5 26 msg_network_down apache
2b61eec8 27 exit 1
28 fi
29else
30 exit 0
0f05f0de
JB
31fi
32
33if is_no "${IPV6_NETWORKING}"; then
2b61eec8 34 HTTPD_OPTS="$HTTPD_OPTS -4"
0f05f0de
JB
35fi
36
dfa42476 37RETVAL=0
0f05f0de
JB
38# See how we were called.
39case "$1" in
40 start)
41 # Check if the service is already running?
e983d4c5 42 if [ ! -f /var/lock/subsys/apache ]; then
43 msg_starting apache
44 daemon apache $HTTPD_OPTS
2b61eec8 45 RETVAL=$?
26e60290 46 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/apache
0f05f0de 47 else
e983d4c5 48 msg_already_running apache
0f05f0de
JB
49 fi
50 ;;
51 stop)
2b61eec8 52 # Stop daemons.
e983d4c5 53 if [ -f /var/lock/subsys/apache ]; then
54 msg_stopping apache
55 killproc apache
8bf769f8 56 rm -f /var/lock/subsys/apache /var/run/apache.pid /var/run/apache.loc* >/dev/null 2>&1
2b61eec8 57 else
e983d4c5 58 msg_not_running apache
0f05f0de
JB
59 fi
60 ;;
61 status)
e983d4c5 62 status apache
dfa42476 63 RETVAL=$?
e983d4c5 64 /usr/sbin/apache -S
0f05f0de 65 ;;
63b43328
PG
66 restart)
67 $0 stop
68 $0 start
69 exit $?
70 ;;
71 reload|force-reload)
e983d4c5 72 if [ -f /var/lock/subsys/apache ]; then
73 msg_reloading apache
78fa435a
ER
74
75 apache -t > /dev/null 2>&1
63b43328 76 RETVAL=$?
78fa435a
ER
77 if [ $RETVAL -eq 0 ]; then
78 killproc apache -HUP
79 else
26e60290
ER
80 fail
81 echo "Configuration file syntax test failed."
78fa435a 82 fi
d89730fb 83 else
e983d4c5 84 msg_not_running apache >&2
63b43328 85 RETVAL=7
d89730fb
PG
86 fi
87 ;;
e8c66f84 88 graceful)
e983d4c5 89 if [ -f /var/lock/subsys/apache ]; then
90 msg_reloading apache
78fa435a
ER
91
92 apache -t > /dev/null 2>&1
e8c66f84 93 RETVAL=$?
78fa435a
ER
94 if [ $RETVAL -eq 0 ]; then
95 killproc apache -USR1
96 else
26e60290
ER
97 fail
98 echo "Configuration file syntax test failed."
78fa435a
ER
99 fi
100 else
e983d4c5 101 msg_not_running apache >&2
e8c66f84
AM
102 RETVAL=7
103 fi
104 ;;
0f05f0de 105 *)
e8c66f84 106 msg_usage "$0 {start|stop|restart|reload|force-reload|graceful|status}"
dfa42476 107 exit 3
0f05f0de
JB
108 ;;
109esac
110
111exit $RETVAL
This page took 0.127383 seconds and 4 git commands to generate.