#!/bin/sh
#
# cWnn       This shell script takes care of starting and stopping
#            cserver (Chinese Conversion Engine).
#
# chkconfig: 2345 90 12
# description: cWnn - Chinese(zh_CN) Conversion Engine
# processname: cserver


# Source function library.
. /etc/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 1

[ -f /usr/bin/cserver ] || exit 1

[ -f /etc/FreeWnn/zh_CN/cserverrc ] || exit 1

# See how we were called.
case "$1" in
  start)
        # Start daemons.
        echo -n "Starting cWnn: "
        rm -f /tmp/cd_sockV4
        /usr/bin/cserver
	echo
	touch /var/lock/subsys/cWnn
        ;;
  stop)
        # Stop daemons.
        echo -n "Shutting down cWnn: "
	killproc cserver
        echo
	rm -f /var/lock/subsys/cWnn
        rm -f /tmp/cd_sockV4
        ;;
  status)
	status cserver
	;;
  restart|reload)
	$0 stop
	$0 start
	;;
  *)
        echo "Usage: cWnn {start|stop|status|restart|reload}"
        exit 1
esac

exit 0
