#! /bin/sh
# Copyright (c) 2003 Sun Microsystems, Inc.
#
# Author: Hidetoshi Tajima <hidetoshi.tajima@sun.com>
#
# /etc/init.d/iiimd for Java Desktop System
#
### BEGIN INIT INFO
# Provides:       iiimd
# Required-Start: $network
# Required-Stop:
# Default-Start:  3 5
# Default-Stop:
# Description:   Internet/Intranet Input Method server.
### END INIT INFO

# Shell functions sourced from /etc/rc.d/init.d/functions
. /etc/rc.d/init.d/functions

IIIMD="/usr/lib/iiim/iiimd-watchdog"
LOCKER="/var/lock/subsys/iiimd"
OPTIONS=""
RETVAL=0

test -x $IIIMD || exit 5

# First reset status of this service

start() {
        echo -n "Starting iiimd"
	$IIIMD $OPTIONS >/dev/null 2>&1 &
	RETVAL=$?
	success
	echo
	touch $LOCKER
}

stop() {
        echo -n "Stopping iiimd"
	killproc iiimd 
	RETVAL=$?
	echo
	rm -f $LOCKER
}

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

exit $RETVAL


