summaryrefslogtreecommitdiff
path: root/www-servers/bozohttpd/files/bozohttpd.initscript
blob: 9374e692765a3c4f2b0f8ca8488d80aa0778feed (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
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# $Id$

#NB: Config is in /etc/conf.d/bozohttpd


depend() {
	need logger net
}

checkconfig() {
	if [ -z "$DATADIR" ] || [ -z "$BIND_ADDRESS" ] || [ -z "$LISTEN_PORT" ]; then
		eerror "You need to setup DATADIR, BIND_ADDRESS and LISTEN PORT in /etc/conf.d/bozohttpd first"
		return 1
	fi
}

start() {
	checkconfig || return 1

	local params=""
	
	[ -n "$USER" ]                     && params="$params -U $USER"	
	[ -n "$INDEX_DEFAULT" ]            && params="$params -x $INDEX_DEFAULT"
	[ -n "$APPEND" ]                   && params="$params $APPEND"	

	ebegin "Starting bozohttpd"
	start-stop-daemon --start --exec /usr/bin/bozohttpd -- -b -i $BIND_ADDRESS -I $LISTEN_PORT -X ${params} $DATADIR
	eend ${?}
}

stop() {
	ebegin "Stopping bozohttpd"
	start-stop-daemon --stop --exec /usr/bin/bozohttpd
	eend ${?}
}