#!/bin/sh # # speech-dispatcher A device independent layer for speech synthesis # # chkconfig: 345 99 01 # # description: A device independent layer for speech synthesis. # # $Id: template.init 9117 2007-11-28 20:28:39Z qboosh # Source function library . /etc/rc.d/init.d/functions # $ speech-dispatcher -h # Usage: speech-dispatcher [-{d|s}] [-l {1|2|3|4|5}] [-p=port] | [-v] | [-h] # Speech Dispatcher -- Common interface for Speech Synthesis (GNU GPL) # # -d, --run-daemon - Run as a daemon # -s, --run-single - Run as single application # -l, --log-level - Set log level (1..5) # -p, --port - Specify a port number # -P, --pid-file - Set path to pid file # -C, --config-dir - Set path to configuration # -v, --version - Report version of this program # -h, --help - Print this info LOGLEVEL="" PORT="" PIDFILE="" RUNAS="root" # Get service config - may override defaults [ -r /etc/sysconfig/speech-dispatcher ] && . /etc/sysconfig/speech-dispatcher [ "$PIDFILE" ] || PIDFILE="/var/run/speech-dispatcher/speech-dispatcher.pid" start() { # Check if the service is already running? if [ ! -f /var/lock/subsys/speech-dispatcher ]; then echo -n "Starting speech-dispatcher: " daemon --user ${RUNAS:-speech-dispatcher} \ "$SERVICE_RUN_NICE_LEVEL" \ speech-dispatcher --pid-file $PIDFILE \ ${LOGLEVEL:+--log-level $LOGLEVEL} RETVAL=$? evaluate_retval echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/speech-dispatcher else echo "speech-dispatcher: already running" fi } stop() { if [ -f /var/lock/subsys/speech-dispatcher ]; then # Stop daemons. echo -n "Stopping speech-dispatcher: " killproc -p $PIDFILE speech-dispatcher -TERM evaluate_retval echo rm -f /var/lock/subsys/speech-dispatcher else echo "speech-dispatcher: not running." fi } reload() { if [ -f /var/lock/subsys/speech-dispatcher ]; then echo -n "Reloading speech-dispatcher: " killproc -p $PIDFILE speech-dispatcher -HUP RETVAL=$? evaluate_retval echo else echo "speech-dispatcher: not_running" RETVAL=7 fi } condrestart() { if [ -f /var/lock/subsys/speech-dispatcher ]; then stop start else echo "speech-dispatcher: not_running" RETVAL=$1 fi } RETVAL=0 # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) stop start ;; try-restart) condrestart 0 ;; reload|force-reload) reload ;; status) status speech-dispatcher RETVAL=$? ;; *) echo "Usage: speech-dispatcher {start|stop|restart|try-restart|reload|force-reload|status}" exit 3 esac exit $RETVAL