summaryrefslogtreecommitdiff
blob: 37c41ab252765ad8a0d25ab8d97be1e306f80040 (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         
# $Header: /var/cvsroot/gentoo-x86/media-sound/daapd/files/daapd.init.d,v 1.4 2005/01/30 01:19:05 luckyduck Exp $

depend() {
	need net
	use mDNSResponder
}

checkconfig() {
	grep '^Root		\.$' /etc/daapd.conf &>/dev/null && \
		ewarn "The Root in /etc/daapd.conf has not been updated. You probably" && \
		ewarn "want to point this to your music archive instead of" `pwd`
}

start() {
	ebegin "Starting daapd"
	checkconfig

	local SSD_OPTS
	SSD_OPTS=""
	[ "${DAAPD_RUNAS}"x != ""x ] && SSD_OPTS="${SSD_OPTS} --chuid '${DAAPD_RUNAS}'"

	start-stop-daemon --start --quiet --pidfile /var/run/daapd.pid \
		--background --make-pidfile \
		${SSD_OPTS} --startas /usr/bin/daapd -- ${DAAPD_OPTS}
	eend $? "Failed to start daapd"
}

stop() {
	ebegin "Stopping daapd"
	start-stop-daemon --stop --quiet --pidfile /var/run/daapd.pid
	eend $? "Failed to stop daapd"

	# clean stale pidfile
	[ -f /var/run/daapd.pid ] && rm -f /var/run/daapd.pid
}