#!/bin/sh
# put this startup script to /etc/init.d,
# and then do "update-rc.d"

# start and stop IIIM server

IIIMD="/usr/lib/iiim/iiimd-watchdog"
OPTIONS=""

# check servers.
test -x $IIIMD || exit 0

case "$1" in
    start)
	echo -n "Start IIIM server"
	start-stop-daemon -b --start --quiet --exec ${IIIMD}
	echo "."
	;;

    stop)
	echo -n "Stop IIIM server"
	start-stop-daemon --stop --quiet --exec ${IIIMD}
	echo "."
	;;

    restart)
	echo -n "Restart IIIM server"
	start-stop-daemon --stop --quiet --exec ${IIIMD}
	sleep 10
	start-stop-daemon -b --start --quiet --exec ${IIIMD}
	echo "."
	;;
    *)
	echo "Usage: $0 { start | stop }"
	exit 1
	;;
esac
exit 0
