#!/bin/bash
#
#/etc/rc.d/init.d/speech-dispatcherd
# Author: Hemant Goyal <goyal.hemant@gmail.com>
#
# chkconfig: - 13 87
# description: provides a high-level device independent layer for speech synthesis
. /etc/rc.d/init.d/functions
exec="/usr/bin/speech-dispatcher"
prog="speech-dispatcherd"
config="/etc/speech-dispatcher/speechd.conf"
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
lockfile=/var/lock/subsys/$prog
start() {
retval=0
[ -x $exec ] || exit 5
[ -f $config ] || exit 6
echo -n $"Starting $prog"
$exec -d -p $lockfile
retval=$?
[ $retval -eq 0 ] && ( touch $lockfile ; success ) || failure
echo
return $retval
}
stop() {
echo -n $"Stopping $prog"" "
echo -n $(/sbin/pidof speech-dispatcher)
kill $(/sbin/pidof speech-dispatcher)
retval=$?
[ $retval -eq 0 ] && ( rm -f $lockfile ; success ) || failure
echo
return $retval
}
restart() {
stop
start
}
reload() {
restart
}
force_reload() {
restart
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
;;
esac
exit $?