summaryrefslogtreecommitdiff
blob: fb7cd1dd84e571574fc85ec4e70d56586e23e663 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-www/apache/files/apache.rc6,v 1.20 2004/07/15 00:24:42 agriffis Exp $

opts="${opts} reload"

depend() {
	need net
	use mysql dns logger netmount postgres
	after sshd
}

start() {
	ebegin "Starting apache"
	env -i PATH=$PATH PERL5LIB=PERL5LIB /sbin/start-stop-daemon -o --quiet \
		--start --startas /usr/sbin/apache \
		--pidfile /var/run/apache.pid -- ${APACHE_OPTS}
	eend $?
}

stop() {
	ebegin "Stopping apache"
	/usr/sbin/apachectl stop >/dev/null
	start-stop-daemon -o --quiet --stop --pidfile /var/run/apache.pid
	eend $?
}

reload() {
	ebegin "Gracefully restarting apache"
	/usr/sbin/apache -t ${APACHE_OPTS} &>/dev/null
	if [ "$?" = "0" ]
	then
		if [ -f /var/run/apache.pid ]
		then
			kill -USR1 $(</var/run/apache.pid)
			eend $?
		else
			svc_start
			eend $?
		fi
	else
		if [ -f /var/run/apache.pid ]
		then
			svc_stop
		fi
		#show the error(s)
		/usr/sbin/apache -t ${APACHE_OPTS}
		eend 1
	fi
}