#!/bin/bash
export BUILD_ID
=DONTKILLME
APP_NAME
=$2
ENV_PROFILE
=$3
function stop
(){
PID
=`ps -ef|grep $APP_NAME|grep -v grep|grep -v springboot.sh|awk '{print $2}'`
if [[ -n
"$PID" ]];then
echo 'Stop Process...'
kill -15
$PID
fi
PID
=`ps -ef|grep $APP_NAME|grep -v grep|grep -v springboot.sh|awk '{print $2}'`
if [[ -n
"$PID" ]];then
echo "PID: $PID"
echo 'Kill Process!.....'
kill -9
$PID
else
echo 'No pid, No process,Stop Success!....'
fi
}
function start
(){
JAVA_OPTS
=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true "
JAVA_MEM_OPTS
=" -server -Xmx512m -Xms512m -Xmn256m -XX:PermSize=128m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 "
nohup java
$JAVA_OPTS $JAVA_MEM_OPTS -jar -Dspring.profiles.active
=$ENV_PROFILE ${APP_NAME}.jar
> /dev/null 2
>&1
&
echo $! $?
echo Start Success
!
}
function status
(){
PID
=`ps -ef|grep $APP_NAME|grep -v grep|grep -v springboot.sh|awk '{print $2}'`
if [[ -n
"$PID" ]]; then
echo "PID:$PID"
echo "$APP_NAME is running."
else
echo "$APP_NAME is downing."
fi
}
case $1 in
start
)
start
;;
stop
)
stop
;;
status
)
status
;;
*
)
echo "./springboot.sh start/stop/status"
;;
esac
exit 0
转载请注明原文地址: https://lol.8miu.com/read-20898.html