summaryrefslogtreecommitdiff
blob: 28946b041a71bffa3803f454a3acb4dc6d388a59 (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
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-servers/lighttpd/files/lighttpd.initd,v 1.6 2005/09/01 15:57:05 ka0ttic Exp $

opts="depend checkconfig start stop"

LIGHTTPD_CONF="/etc/lighttpd/lighttpd.conf"
LIGHTTPD_PID="/var/run/lighttpd.pid"

depend() {
	need net
	use mysql logger spawn-fcgi ldap famd
	after sshd
}

checkconfig() {
	if [[ ! -f ${LIGHTTPD_CONF} ]] ; then
		ewarn "${LIGHTTPD_CONF} does not exist."
		return 1
	fi

	/usr/sbin/lighttpd -t -f ${LIGHTTPD_CONF} >/dev/null
}
			
start() {
	checkconfig || return 1

	ebegin "Starting lighttpd"
	start-stop-daemon --start --quiet \
		--pidfile ${LIGHTTPD_PID} \
		--exec /usr/sbin/lighttpd -- -f ${LIGHTTPD_CONF}
	eend $?
}

stop() {
	local rv=0
	ebegin "Stopping lighttpd"
	if start-stop-daemon --stop --quiet --pidfile ${LIGHTTPD_PID} \
			--signal 2 ; then
		rm -f /var/run/lighttpd.pid
	else
		rv=1
	fi
	eend $rv
}