#!/bin/sh
PORT="@profiles.server.port@"
BASEDIR=`dirname $0`
BASEDIR=`(cd "$BASEDIR"; pwd)`
PROJECT_NAME="@project.artifactId@"
MAIN_CLASS="$PROJECT_NAME";
SUCCESS=0
FAIL=9
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 $FAIL;
fi

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

kill -15 ${pid}

echo "Send shutdown request to Server $PROJECT_NAME OK"


