summaryrefslogtreecommitdiffstats
path: root/main/mini_httpd/mini_httpd.initd
blob: 4b0910500ce1ce1a300eb674718ef1f3485dcbef (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
# $Header: /var/cvsroot/gentoo-x86/www-servers/mini_httpd/files/mini_httpd.init,v 1.2 2007/08/26 21:20:21 bangert Exp $

pidfile=/var/run/mini_httpd/${SVCNAME}.pid

depend() {
	need net
	after firewall
}

start() {
	local logfile=$(awk -F= '$1 == "logfile" { print $2 }' /etc/mini_httpd/${SVCNAME}.conf 2>/dev/null)
	: ${logfile:=/var/log/mini_httpd/${SVCNAME}.log}
	checkpath -d ${pidfile%/*}
	checkpath -d ${logfile%/*}
	ebegin "Starting $SVCNAME"
	start-stop-daemon --quiet --start --exec /usr/sbin/mini_httpd \
		--pidfile $pidfile -- -i $pidfile \
		${MINI_HTTPD_OPTS:--C /etc/mini_httpd/${SVCNAME}.conf -l ${logfile}}
	eend $?
}

stop() {
	ebegin "Stopping $SVCNAME"
	start-stop-daemon --quiet --stop --pidfile $pidfile
	eend $?
}