Linux之项目启动脚本

start.sh

#! /bin/bash

moduleName="TestApp"

pidPath="./$moduleName-tpid"
rm -f $pidPath

JAVA_OPTIONS="-XX:+HeapDumpOnOutOfMemoryError  "
JAVA_OPTIONS="$JAVA_OPTIONS -XX:HeapDumpPath=./logs/heapdump_%p "
JAVA_OPTIONS="$JAVA_OPTIONS -verbose:gc -Xloggc:./logs/gc_%p.log -XX:+PrintGCDetails "
JAVA_OPTIONS="$JAVA_OPTIONS -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime "
JAVA_OPTIONS="$JAVA_OPTIONS -XX:+PrintAdaptiveSizePolicy"
JAVA_OPTIONS="$JAVA_OPTIONS -XX:+UseTLAB"
JAVA_OPTIONS="$JAVA_OPTIONS -XX:MaxTenuringThreshold=0"

PROGRAM_PARA=" --spring.config.location=file:./bootstrap.properties"

java -jar  $JAVA_OPTIONS ./$moduleName.jar $PROGRAM_PARA &

echo $!>$pidPath

stop.sh

#! /bin/bash

moduleName="TestApp"

tpid=`cat ./$moduleName-tpid | awk '{print $1}'`

tpid=`ps -aef | grep $tpid | grep -v grep | grep $moduleName |awk '{print $2}' `

if [ ${tpid} ];then
	kill -9 $tpid
fi

 

你可能感兴趣的:(#,Linux)