Linux环境下以命令和脚本方式启动jar包

start.sh

启动

#!/bin/bash java -Dfile.encoding=utf-8 -jar -server -Xms512m -Xmx512m -Xss256K -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC -jar /mnt/warehouse/fur-warehouse-2.0.1-SNAPSHOT-exec.jar >/dev/null &

 

 

stop.sh

停止

#!/bin/bash PID=$(ps -ef | grep fur-warehouse-2.0.1-SNAPSHOT-exec.jar | grep -v grep | awk '{ print $2 }') if [ -z "$PID" ] then echo Application is already stopped else echo kill -9 $PID kill -9 $PID fi

 

run.sh

重启

#!/bin/bash echo stop application source stop.sh echo start application source start.sh

 

你可能感兴趣的:(linux)