2010-06-25 13:35:33 +02:00
|
|
|
#!/sbin/runscript
|
|
|
|
# Copyright 1999-2004 Gentoo Foundation
|
|
|
|
# Distributed under the terms of the GNU General Public License v2
|
2010-06-25 14:45:01 +02:00
|
|
|
# $Header: /var/cvsroot/gentoo-x86/media-sound/forked-daapd/files/forked-daapd.init.2,v 1.4 2010/01/25 16:27:26 patrick Exp $
|
|
|
|
# Somehow based on init.d file shipped with forked-daapd itself.
|
2010-06-25 13:35:33 +02:00
|
|
|
#
|
|
|
|
# You can run multiple copies of this service just symlinking them to
|
2010-06-25 14:45:01 +02:00
|
|
|
# forked-daapd.<name>, then it will load /etc/forked-daapd.d/<name>.conf as config
|
2010-06-25 13:35:33 +02:00
|
|
|
# file.
|
|
|
|
# Remember to give them different logs and cache directories.
|
|
|
|
#
|
2010-06-25 14:45:01 +02:00
|
|
|
# The main instance (with no <name>) uses /etc/forked-daapd.conf
|
2010-06-25 13:35:33 +02:00
|
|
|
|
|
|
|
# Check for OpenRC/Baselayout 2 -- see bug #230917
|
|
|
|
if [ -f /lib/librc.so -o -f /etc/init.d/sysfs -o -f /lib/rc/version ]; then
|
|
|
|
myservice=$RC_SVCNAME
|
|
|
|
fi
|
|
|
|
|
|
|
|
CONF="${myservice##*.}"
|
2010-06-25 14:45:01 +02:00
|
|
|
if [[ -n ${CONF} && ${myservice} != "forked-daapd" ]]; then
|
|
|
|
PIDFILE="/var/run/forked-daapd.${CONF}.pid"
|
|
|
|
CONFFILE="/etc/forked-daapd.d/${CONF}.conf"
|
2010-06-25 13:35:33 +02:00
|
|
|
else
|
2010-06-25 14:45:01 +02:00
|
|
|
PIDFILE="/var/run/forked-daapd.pid"
|
|
|
|
CONFFILE="/etc/forked-daapd.conf"
|
2010-06-25 13:35:33 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
depend() {
|
|
|
|
need net
|
|
|
|
}
|
|
|
|
|
|
|
|
start() {
|
2010-06-25 14:45:01 +02:00
|
|
|
ebegin "Starting forked-daapd DAAP server"
|
2010-06-25 13:35:33 +02:00
|
|
|
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
|
2010-06-25 14:45:01 +02:00
|
|
|
--exec /usr/sbin/forked-daapd -- -P ${PIDFILE} -c ${CONFFILE}
|
2010-06-25 13:35:33 +02:00
|
|
|
eend $?
|
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
2010-06-25 14:45:01 +02:00
|
|
|
ebegin "Stopping forked-daapd DAAP server"
|
2010-06-25 13:35:33 +02:00
|
|
|
start-stop-daemon --stop --quiet --pidfile ${PIDFILE} --signal 2
|
|
|
|
eend $?
|
|
|
|
|
|
|
|
rm -f ${PIDFILE}
|
|
|
|
}
|