1#!/bin/bash
2#
3# chkconfig: 2345 85 15
4# description: mt-daapd is a multi-threaded DAAP server for iTunes
5# processname: mt-daapd
6# pidfile: /var/run/mt-daapd
7#
8
9# source function library
10. /etc/init.d/functions
11[ -e /etc/daapd.conf ]
12
13RETVAL=0
14
15start() {
16	echo -n $"Starting DAAP server: "
17	daemon mt-daapd 
18	RETVAL=$?
19	echo
20	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/mt-daapd
21}
22
23stop() {
24	echo -n $"Shutting down DAAP server: "
25	# This is broken.
26	killall -INT mt-daapd
27#	killproc mt-daapd
28	RETVAL=$?
29
30	echo
31	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/mt-daapd
32}
33
34case "$1" in
35  start)
36	start
37	;;
38  stop)
39	stop
40	;;
41  restart|reload)
42	stop
43	start
44	RETVAL=$?
45	;;
46  status)
47	status mt-daapd
48	RETVAL=$?
49	;;
50  *)
51	echo $"Usage: $0 {start|stop|restart|condrestart|status}"
52	exit 1
53esac
54
55exit $RETVAL
56
57