#!/bin/bash

BASE_DIR="$(cd "$(dirname "$0")"; pwd)";

. $BASE_DIR/env.sh

PID=`ps -ef | grep java | grep wasup.websocket.endpoint | grep "$AGENT_PROCESS_NAME" | awk '{print $2}'`

if [ e$PID == "e" ] ; then
    logger -s "${AGENT_PROCESS_NAME} is not running."
    exit;
fi

ps -ef | grep java | grep wasup.websocket.endpoint | grep "$AGENT_PROCESS_NAME" | awk {'print "kill -9 " $2'} | sh -x