summaryrefslogtreecommitdiff
blob: 1da337229b2dfe736ae3b5c6630b6d7fd421b7c2 (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-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-www/apache/files/2.0.40/apache2.initd,v 1.12 2003/10/30 19:57:10 woodchip Exp $

opts="${opts} reload"

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

start() {
	ebegin "Starting apache2"
	[ -f /var/log/apache2/ssl_scache ] && rm /var/log/apache2/ssl_scache
	env -i /sbin/start-stop-daemon --quiet --start --startas /usr/sbin/apache2 \
		--pidfile /var/run/apache2.pid -- -k start ${APACHE2_OPTS}
	eend $?
}

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

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