#!/bin/bash
### BEGIN INIT INFO
# Provides: nasd
# Default-Start: 5
# Default-Stop: 0 1 2 3 4 6
# Short-Description: start the nas daemon
# Description: Network transparent audio server
### END INIT INFO
# Only for Fedora
# chkconfig: 345 88 88
#Servicename
SERVICE=nasd
#Source function library.
. /etc/init.d/functions
[ -f /usr/bin/$SERVICE ] || exit 0
# Source config
if [ -f /etc/sysconfig/$SERVICE ] ; then
. /etc/sysconfig/$SERVICE
else
NASD_OPTIONS="-b -local"
fi
RETVAL=0
start() {
#not for now #Be sure that /dev/dsp is readable
#not for now chmod g+rw /dev/sound/*
#not for now daemon --user=$SERVICE $SERVICE $NASD_OPTIONS
#if running return 0
if [ -n "`/sbin/pidof $SERVICE`" ]; then
RETVAL=0
return $RETVAL
fi
daemon $SERVICE $NASD_OPTIONS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$SERVICE
return $RETVAL
}
stop() {
#if not running return 0
if [ -z "`/sbin/pidof $SERVICE`" ]; then
RETVAL=0
return $RETVAL
fi
killproc $SERVICE
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$SERVICE
return $RETVAL
}
rhstatus() {
status $SERVICE
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
rhstatus
;;
restart|reload)
restart
;;
condrestart)
[ -f /var/lock/subsys/$SERVICE ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart}"
exit 1
esac
exit $?