]>
Commit | Line | Data |
---|---|---|
162dab2c | 1 | #!/bin/sh |
2 | # | |
3 | # speech-dispatcher A device independent layer for speech synthesis | |
4 | # | |
5 | # chkconfig: 345 99 01 | |
6 | # | |
7 | # description: A device independent layer for speech synthesis. | |
8 | # | |
c8dd477b | 9 | # $Id: template.init 9117 2007-11-28 20:28:39Z qboosh |
162dab2c | 10 | |
11 | # Source function library | |
12 | . /etc/rc.d/init.d/functions | |
13 | ||
14 | # $ speech-dispatcher -h | |
15 | # Usage: speech-dispatcher [-{d|s}] [-l {1|2|3|4|5}] [-p=port] | [-v] | [-h] | |
16 | # Speech Dispatcher -- Common interface for Speech Synthesis (GNU GPL) | |
17 | # | |
18 | # -d, --run-daemon - Run as a daemon | |
19 | # -s, --run-single - Run as single application | |
20 | # -l, --log-level - Set log level (1..5) | |
21 | # -p, --port - Specify a port number | |
22 | # -P, --pid-file - Set path to pid file | |
23 | # -C, --config-dir - Set path to configuration | |
24 | # -v, --version - Report version of this program | |
25 | # -h, --help - Print this info | |
26 | ||
27 | LOGLEVEL="" | |
28 | PORT="" | |
29 | PIDFILE="" | |
30 | RUNAS="" | |
31 | ||
32 | # Get service config - may override defaults | |
33 | [ -f /etc/sysconfig/speech-dispatcher ] && . /etc/sysconfig/speech-dispatcher | |
34 | ||
35 | start() { | |
36 | # Check if the service is already running? | |
37 | if [ ! -f /var/lock/subsys/speech-dispatcher ]; then | |
38 | msg_starting speech-dispatcher | |
39 | daemon --user ${RUNAS:-speech-dispatcher} \ | |
40 | "$SERVICE_RUN_NICE_LEVEL" \ | |
41 | speech-dispatcher --pid-file ${PIDFILE:-/var/run/speech-dispatcher/speech-dispatcher.pid} \ | |
42 | ${LOGLEVEL:+--log-level $LOGLEVEL} | |
43 | RETVAL=$? | |
44 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/speech-dispatcher | |
45 | else | |
46 | msg_already_running speech-dispatcher | |
47 | fi | |
48 | } | |
49 | ||
50 | stop() { | |
51 | if [ -f /var/lock/subsys/speech-dispatcher ]; then | |
52 | # Stop daemons. | |
53 | msg_stopping speech-dispatcher | |
162dab2c | 54 | killproc --pidfile ${PIDFILE:-/var/run/speech-dispatcher/speech-dispatcher.pid} speech-dispatcher -TERM |
55 | rm -f /var/lock/subsys/speech-dispatcher | |
56 | else | |
57 | msg_not_running speech-dispatcher | |
58 | fi | |
59 | } | |
60 | ||
61 | reload() { | |
62 | if [ -f /var/lock/subsys/speech-dispatcher ]; then | |
63 | msg_reloading speech-dispatcher | |
162dab2c | 64 | killproc --pidfile ${PIDFILE:-/var/run/speech-dispatcher/speech-dispatcher.pid} speech-dispatcher -HUP |
65 | RETVAL=$? | |
66 | else | |
67 | msg_not_running speech-dispatcher | |
68 | RETVAL=7 | |
69 | fi | |
70 | } | |
71 | ||
72 | condrestart() { | |
73 | if [ -f /var/lock/subsys/speech-dispatcher ]; then | |
74 | stop | |
75 | start | |
76 | else | |
77 | msg_not_running speech-dispatcher | |
78 | RETVAL=$1 | |
79 | fi | |
80 | } | |
81 | ||
82 | RETVAL=0 | |
83 | # See how we were called. | |
84 | case "$1" in | |
85 | start) | |
86 | start | |
87 | ;; | |
88 | stop) | |
89 | stop | |
90 | ;; | |
91 | restart) | |
92 | stop | |
93 | start | |
94 | ;; | |
95 | try-restart) | |
96 | condrestart 0 | |
97 | ;; | |
162dab2c | 98 | reload|force-reload) |
99 | reload | |
100 | ;; | |
162dab2c | 101 | status) |
102 | status speech-dispatcher | |
103 | RETVAL=$? | |
104 | ;; | |
105 | *) | |
106 | msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}" | |
107 | exit 3 | |
108 | esac | |
109 | ||
110 | exit $RETVAL |