#!/bin/bash
source /etc/profile
file_path=/home/
jar_name=xxx-0.0.1-SNAPSHOT.jar
tomcat_id=$(ps -ef|grep $jar_name|grep -v "grep"|awk '{print $2}')
if [ ! -z "$tomcat_id" ]
then
kill -9 $tomcat_id
fi
nohup java -jar -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m -Xms512m -Xmx512m -Xmn256m -Xss256k -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC ${file_path}${jar_name} >> ${file_path}intellisia.log 2>&1 &
如果没有执行权限
chmod -R 777 ./
或者
chmod u+x xxx.sh