#!/bin/bash # # chkconfig: - 85 15 # description: mt-daapd is a multi-threaded DAAP server for iTunes # processname: mt-daapd # pidfile: /var/run/mt-daapd # # source function library . /etc/init.d/functions prog="mt-daapd" conf="/etc/$prog.conf" [ -f $conf ] || exit 0 RETVAL=0 start() { echo -n $"Starting $prog: " $prog -m -y -c $conf & RETVAL=$? [ $RETVAL -eq 0 ] && success || failure echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/mt-daapd return $RETVAL } stop() { echo -n $"Shutting down $prog: " killproc $prog RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/mt-daapd return $RETVAL } case "$1" in start) start ;; stop) stop ;; restart|reload) stop start RETVAL=$? ;; condrestart) [ -e /var/lock/subsys/mt-daapd ] && $0 restart ;; status) status $prog RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart|condrestart|status}" exit 1 esac exit $RETVAL