天天看点

jar包重启脚本

#!/bin/bash
# jar包地址
PROJECT_PATH=mtkj-api-2.0.jar
# 日志输出地址
LOG_PATH=consoleMsg.log
PID=$(ps -ef | grep $PROJECT_PATH | grep -v grep | awk '{ print $2 }')
if [ -z "$PID" ]
then
    echo Application is already stopped
else
    echo kill $PID
    kill -9 $PID
fi

nohup java -Xms512m -Xmx1024m -jar $PROJECT_PATH >$LOG_PATH 2>&1 &