drone_coding_java/bin/start.sh

30 lines
796 B
Bash
Raw Normal View History

2024-07-31 10:11:57 +08:00
#!/bin/sh
cd $PWD
2024-09-05 14:03:09 +08:00
pid=$(ps -ef | grep drone-coding.jar | grep -v grep | awk '{print $2}')
2024-07-31 10:11:57 +08:00
if [ -n "$pid" ]; then
kill -9 $pid
fi
# 优化JVM参数
JAVA_OPTS="$MAVEN_OPTS -Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m"
# 方式一、配置外部自定义的属性文件(建议)
JAVA_OPTS="$JAVA_OPTS -Dspring.config.location=$PWD\application.yml"
# 方式二、配置环境名称,加载不同的属性文件
# JAVA_OPTS="$JAVA_OPTS -Dspring.profiles.active=prod"
if [ -z "$JAVA_HOME" ]; then
RUN_JAVA=java
else
RUN_JAVA="$JAVA_HOME"/bin/java
fi
# 根据情况修改 web.war 为您的 war 包名称
2024-09-05 14:03:09 +08:00
nohup $RUN_JAVA $JAVA_OPTS -jar drone-coding.jar > system.log 2>&1 &
2024-07-31 10:11:57 +08:00
sleep 1
2024-09-05 14:03:09 +08:00
pid=$(ps -ef | grep drone-coding.jar | grep -v grep | awk '{print $2}')
2024-07-31 10:11:57 +08:00
echo $pid6