File rcftwnn of Package fwnn

#! /bin/sh
# Copyright (c) 1996, 2000 S.u.S.E. GmbH Fuerth, Germany.  All rights reserved.
#
# Author: Mike Fabian  <mfabian@suse.de>, 2000
#
# /etc/init.d/ftwnn
#
### BEGIN INIT INFO
# Provides:       ftwnn
# Required-Start: $network $remote_fs $named
# Required-Stop: $network $remote_fs $named
# Default-Start:  3 5
# Default-Stop:
# Description:   Free Wnn Taiwan-Chinese Server, for input of traditional Chinese
### END INIT INFO

. /etc/rc.status

FREE_TWNN_BIN=/usr/bin/tserver
test -x $FREE_TWNN_BIN || exit 5

# First reset status of this service
rc_reset

if [ ! -f /etc/FreeWnn/zh_TW/tserverrc ] ; then
    echo "can't find /etc/FreeWnn/zh_TW/tserverrc"
    # program is not configured
    exit 6
fi

case "$1" in
    start)
        echo -n "Starting Free Wnn Taiwan-Chinese Server"
        if test -e /tmp/td_sockV4 ; then
                rm /tmp/td_sockV4
        fi
	# redirect message
	#    "startproc:  startproc:  signal catched /usr/bin/tserver: Terminated
	# to /dev/null
        startproc -u wnn -q -t 1 $FREE_TWNN_BIN > /dev/null 2>&1
        rc_status -v
        ;;
    stop)
        echo "Shutting down Free Wnn Taiwan-Chinese Server"
        # don't use 'cwnnkill', because this doesn't kill tserver
        # if there are still clients.
        killproc -TERM $FREE_TWNN_BIN
        rc_status -v
        if test -e /tmp/td_sockV4 ; then
                rm /tmp/td_sockV4
        fi
        ;;
    try-restart)
        $0 status >/dev/null && $0 restart
        rc_status
        ;;
    restart)
        $0 stop
        $0 start
        rc_status
        ;;
    force-reload)
        $0 stop && $0 start
        rc_status
        ;;
    reload)
        rc_failed 3
        rc_status -v
        ;;
    status)
        echo -n "Checking for Free Wnn Taiwan-Chinese Server"
        checkproc $FREE_TWNN_BIN
        rc_status -v
        ;;
    full-status)
        $0 status
        rc_status
        if test -x /usr/bin/cwnnstat ; then
            /usr/bin/cwnnstat
        else
                echo "Full status not available, can't start \`/usr/bin/cwnnstat'"
        fi
        ;;
    *)
        echo "Usage: $0 {start|stop|try-restart|restart|force-reload|reload|status|full-status}"
        exit 1
        ;;
esac

rc_exit
openSUSE Build Service is sponsored by