#! /bin/sh
PORT="80"
BASEDIR=$(dirname $0)
BASEDIR=$( (
  cd "$BASEDIR"
  pwd
))
PROJECT_NAME="mid-service"
MAIN_CLASS="$PROJECT_NAME"

if [ ! -n "$PORT" ]; then
  echo $"Usage: $0 {port}"
  exit $FAIL
fi

pid=$(ps ax | grep -i "$MAIN_CLASS" | grep java | grep -v grep | awk '{print $1}')
if [ -z "$pid" ]; then
  echo "No Server running."
  exit 1
fi

echo "stoping application $PROJECT_NAME......"

kill -15 ${pid}

echo "Send shutdown request to Server $PROJECT_NAME OK"
