cription: Starts and stops the App.
ENV=production
RUNNING_USER=root
ADATE=date +%Y%m%d%H%M%S
APP_NAME=bootdo
APP_HOME=/opt/bootdo
APP_SERVER_LOG=$APP_HOME/bootdo-log
SERVER_PORT=8080
if [ ! -d "APP_SERVER_LOG
fi
LOG_PATH=APP_NAME.log
GC_LOG_PATH=APP_NAME-$ADATE.log
JMX监控需用到
JMX="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=1091 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
JVM参数
JVM_OPTS="-Dname=ENV -Dapp.logPath=$APP_SERVER_LOG -Duser.timezone=Asia/Shanghai -Xmx2048m -Xms2048m -Xmn2048m -Xss512k -XX:ReservedCodeCacheSize=96m -XX:MaxPermSize=512m -XX:+UseG1GC -XX:MaxGCPauseMillis=10 -XX:GCPauseIntervalMillis=200"
JAR_FILE=APP_NAME.jar
pid=0
start(){
checkpid
if [ ! -n "JVM_OPTS SERVER_PORT LOG_PATH 2>&1 &"
su - JAVA_CMD"
echo "---------------------------------"
echo "启动完成,按CTRL+C退出日志界面即可>>>>>"
echo "---------------------------------"
sleep 2s
tail -f APP_NAME is runing PID: $pid"
fi
}
status(){
checkpid
if [ ! -n "APP_NAME not runing"
else
echo "pid"
fi
}
checkpid(){
pid=ps -ef |grep $JAR_FILE |grep -v grep |awk '{print $2}'
}
stop(){
checkpid
if [ ! -n "APP_NAME not runing"
else
echo "pid
#curl -X POST http://localhost:$SERVER_PORT/qixi/shutdown
fi
while true
#do
# process=`ps -ef |grep $JAR_FILE |grep -v grep |awk '{print $2}'`
# if [ ! -n "$process" ]; then
# echo "$APP_NAME 服务已经停止"
# break
# else
# echo "正在停止 $APP_NAME"
# sleep 1s
#fi
#done
}
restart(){
stop
sleep 1s
start
}
case $1 in
start) start;;
stop) stop;;
restart) restart;;
status) status;;
*) echo "require start|stop|restart|status" ;;
esac
网友评论