8 # Source function library
9 . /etc/rc.d/init.d/functions
11 # Get service config - may override defaults
12 [ -f /etc/sysconfig/tenshi ] && . /etc/sysconfig/tenshi
14 # do some sanity check
15 if grep -q sample /etc/tenshi/tenshi.conf; then
16 echo >&2 "Please configure /etc/tenshi/tenshi.conf before starting. Remove word 'sample' when done."
21 # must return non-zero if check failed
22 # output is discarded if checkconfig is ran without details
24 /usr/sbin/tenshi -C -c /etc/tenshi/tenshi.conf
28 # wrapper for configtest
32 if [ $details = 1 ]; then
33 # run config test and display report (status action)
34 show "Checking %s configuration" "tenshi"; busy
36 out=$(configtest 2>&1)
38 if [ $RETVAL = 0 ]; then
43 [ "$out" ] && echo >&2 "$out"
45 # run config test and abort with nice message if failed
46 # (for actions checking status before action).
47 configtest >/dev/null 2>&1
49 if [ $RETVAL != 0 ]; then
50 show "Checking %s configuration" "tenshi"; fail
51 nls 'Configuration test failed. See details with %s "checkconfig"' $0
58 # Check if the service is already running?
59 if [ -f /var/lock/subsys/tenshi ]; then
60 msg_already_running "tenshi"
66 daemon /usr/sbin/tenshi -c /etc/tenshi/tenshi.conf -P /var/run/tenshi/tenshi.pid
68 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/tenshi
72 if [ ! -f /var/lock/subsys/tenshi ]; then
73 msg_not_running "tenshi"
80 rm -f /var/lock/subsys/tenshi /var/run/tenshi/tenshi.pid
84 if [ ! -f /var/lock/subsys/tenshi ]; then
85 msg_not_running "tenshi"
91 msg_reloading "tenshi"
92 killproc --pidfile /var/run/tenshi/tenshi.pid tenshi -HUP
97 if [ ! -f /var/lock/subsys/tenshi ]; then
98 msg_not_running "tenshi"
104 echo "Flushing all queues"
105 killproc --pidfile /var/run/tenshi/tenshi.pid tenshi -USR2
110 if [ ! -f /var/lock/subsys/tenshi ]; then
111 msg_not_running "tenshi"
122 # See how we were called.
144 checkconfig|configtest)
152 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|checkconfig|status}"