You are here: Home » Reply

Reply To: Rewritten init.d script for CentOS 5.4

#18891

Anonymous

Oops… the script:

#!/bin/bash
#
# chkconfig: 2345 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
[ -e /etc/daapd.conf ]

RETVAL=0
pidfile="/var/run/mt-daapd.pid"
exec="/usr/local/sbin/mt-daapd"
lockfile="/var/lock/subsys/mt-daapd"

start() {
echo -n $"Starting DAAP server: "
daemon --pidfile $pidfile $exec
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $lockfile
echo
}

stop() {
echo -n $"Shutting down DAAP server: "
killproc -p $pidfile $exec
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f $lockfile
echo
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
sleep 1
start
RETVAL=$?
;;
status)
status -p $pidfile $exec
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac

exit $RETVAL