#! /bin/sh
#
# If you want to use Juman server, copy this script to /etc/init.d/
# and call update-rc.d to install the links of the copied script.
#

NAME=juman
DAEMON="/usr/bin/$NAME"
DESC="Juman server"

test -f $DAEMON || exit 0

PARAMS="-S"

case "$1" in
    start)
	check_for_no_start
	echo -n "Starting $DESC: "
	start-stop-daemon --start --quiet --background --exec $DAEMON -- $PARAMS
	echo "$NAME."
	;;
    stop)
	echo -n "Stopping $DESC: "
	start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid
	echo "$NAME."
	;;
    restart|force-reload)
	echo -n "Restarting $DESC: "
	start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid
	sleep 1
	start-stop-daemon --start --quiet --background --exec $DAEMON -- $PARAMS
	echo "$NAME."
	;;
    *)
	N=/etc/init.d/$NAME
	echo "Usage: $N {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0
