30 lines
775 B
Bash
30 lines
775 B
Bash
#!/bin/sh
|
|
|
|
cd $PWD
|
|
pid=$(ps -ef | grep video.jar | grep -v grep | awk '{print $2}')
|
|
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 包名称
|
|
nohup $RUN_JAVA $JAVA_OPTS -jar video.jar > system.log 2>&1 &
|
|
|
|
sleep 1
|
|
pid=$(ps -ef | grep video.jar | grep -v grep | awk '{print $2}')
|
|
echo $pid
|