#!/bin/sh
#
# /etc/init.d/wnn: start or stop Wnn jserver.

# Source Wnn configuration, if available

if [ -f /etc/wnn.conf ]; then
    . /etc/wnn.conf
else
    run_jserver=1
fi

# The following value is extracted by debstd to figure out how to generate
# the postinst script. Edit the field to change the way the script is
# registered through update-rc.d (see the manpage for update-rc.d!)

FLAGS="defaults 99 1"

test -x /usr/bin/Wnn4/jserver || exit 0

case "$1" in
  start)
    if [ $run_jserver = 1 ]; then
      start-stop-daemon --start --verbose --exec /usr/bin/Wnn4/jserver
    fi
    ;;
  stop)
    if [ $run_jserver = 1 ]; then
      start-stop-daemon --stop --verbose --exec /usr/bin/Wnn4/jserver
    fi
    ;;
  restart|force-reload)
    if [ $run_jserver = 1 ]; then
      start-stop-daemon --stop --verbose --exec /usr/bin/Wnn4/jserver
      start-stop-daemon --start --verbose --exec /usr/bin/Wnn4/jserver
    fi
    ;;
  *)
    echo "Usage: /etc/init.d/wnn {start|stop|restart|force-reload}"
    exit 1
esac

exit 0
