#!/bin/bash
#
# chkconfig: 2345 90 12
# description: Canna Japanese Conversion Engine
#
# canna         Canna server
#
# Author       Manabe Takashi 
# Modifier     Atsushi Yamagata 
# Modifier 22 Jan 1999 Atsushi Yamagata 
# Modifier 23 Jun 1999 Shoichiro Nagata 
# Modifier 04 Feb 2003 Yukihiro Nakai 

# Source function library.
. /etc/init.d/functions
 
PATH=$PATH:/usr/sbin
SERVER=/usr/sbin/cannaserver
KILLER=/usr/bin/cannakill
prog="Canna server"


[ -f $SERVER ] || exit 0
 
start() {
        rm -f /tmp/.iroha_unix/IROHA
        echo -n $"Starting $prog: "
        initlog -c "$SERVER -syslog -u bin"
	initlog -c cannaping && success || failure
	RETVAL=$?
	[ "$RETVAL" = 0 ] && touch /var/lock/subsys/canna
	echo
}

stop() {
        action "Stopping $prog:" $KILLER 2> /dev/null
        rm -f /tmp/.iroha_unix/IROHA
        rm -f /var/lock/subsys/canna
}

case "$1" in
  start)
	start
        ;;
  stop)
	stop
        ;;
  status)
        status cannaserver
        ;;
  restart|reload)
        stop
        start
        ;;
  condrestart)
	if [ -f /var/lock/subsys/canna ]; then
	    stop
	    start
	fi
	;;
  *)
        echo $"Usage: $0 {start|stop|restart|condrestart|status}"
        exit 1
esac
 
exit 0