#!/bin/bash
app=$1

# 检查是否传参
if [ -z "$app" ]; then
  echo "Usage: $0 <app>"
  exit 1
fi


# 检查是否运行中
pid=`ps -ef|grep ${app}*.jar|grep -v jar|awk '{print $2}'`
if [ -z "$pid" ]; then
    echo "Error: $app is not running."
else
    echo "Kill $app process..."
    kill -9 $pid
fi

echo "Start $app..."
nohup java -jar ${app}*.jar > /dev/null 2>&1 &

echo "Done."

