summaryrefslogtreecommitdiff
blob: 0821887c3b21aa07f9b00d26c40e6af4ec86e107 (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
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/www-servers/thttpd/files/thttpd-2.25/thttpd.init,v 1.2 2006/09/06 14:31:17 dsd Exp $

depend() {
	need net
}

start() {
	ebegin "Starting thttpd"
	if [ ! -d "$THTTPD_DOCROOT" ]; then
		eend 1 "THTTPD_DOCROOT not set correctly in /etc/conf.d/thttpd"
		exit 1
	fi
	start-stop-daemon --quiet --start --startas /usr/sbin/thttpd \
		--pidfile /var/run/thttpd.pid --chdir "$THTTPD_DOCROOT" -- \
			${THTTPD_OPTS}
	eend $?
}

stop() {
	local rc

	ebegin "Stopping thttpd"
	start-stop-daemon --quiet --stop --pidfile /var/run/thttpd.pid
	rc=$?
	rm -f /var/run/thttpd.pid
	eend $rc
}