wuweihao il y a 3 ans
Parent
commit
e94b7f48b2

+ 1 - 0
gis_application/pom.xml

@@ -14,6 +14,7 @@
     <artifactId>gis_application</artifactId>
     <version>1.0.0</version>
     <packaging>jar</packaging>
+    <!--<packaging>war</packaging>-->
     <name>gis_application</name>
     <description>项目入口</description>
 

+ 1 - 1
gis_application/src/main/resources/application-pro.properties

@@ -1,6 +1,6 @@
 
 #log
-logging.path=/root/data/${project.name}_log
+logging.path=/root/log/${project.name}_log
 logging.config=classpath:logback-spring.xml
 logging.level.com.gis=debug
 

+ 60 - 0
gis_application/src/main/resources/sh/run.sh

@@ -0,0 +1,60 @@
+#!/bin/sh
+APP_NAME=wx_reload_beijing.jar
+APP_PORT=8007
+APP_EVN=$2   #执行环境 sit|pro
+APP_ORDER=$1   #执行方法  start|stop|restart
+# 获取进程号
+APP_PID=`netstat -ntpl | grep $APP_PORT | grep LISTEN | awk '{print $7}' | awk -F "/" '{print $1}'`
+
+
+# 启动命令
+startApp(){
+    if [ ${APP_PID} ];
+    then
+    	echo "程序已经在运行了"
+    else
+    	echo "执行 start 方法"
+    	nohup java -jar -Xmx3072M -Xms512M ./$APP_NAME --spring.profiles.active=$APP_EVN --server.port=$APP_PORT > logs.log 2>error.log &  # 说明pid为空
+	echo Start Success!
+fi
+}
+
+# 停止命令
+stopApp(){
+    echo "执行 stop 方法"
+    if [ ${APP_PID} ];
+	then
+		echo $APP_NAME "存在,执行 stop 方法"
+			kill -9 ${APP_PID} && echo 'Kill Process!'
+	else
+		echo $APP_NAME 没有运行
+    fi
+}
+
+# 重启命令
+restartApp(){
+    echo " 1 执行 restart 方法"
+	stopApp
+	APP_PID=''  #将进程号置空
+	sleep 2
+	echo "进程号:" ${APP_PID}
+	echo " 2 执行 restart 方法"
+	startApp
+}
+
+# 判断执行命令 取第一个参数
+case $APP_ORDER in
+    "start")
+        startApp
+        ;;
+    "stop")
+        stopApp
+        ;;
+	"restart")
+		restartApp
+        ;;
+        *)
+     ;;
+esac
+
+

+ 0 - 11
gis_application/src/main/resources/templates/1/shutdown.sh

@@ -1,11 +0,0 @@
-#!/bin/bash
-RESOURCE_NAME=wx_reload_beijing.jar
-   Pid=`awk '{print $1}' tpid`
-
-if [ ${Pid} ]; then
-kill -9 $Pid
-echo 'Kill Process!'
-else
-echo 'Stop failed!'
-fi
-

+ 0 - 13
gis_application/src/main/resources/templates/1/start.sh

@@ -1,13 +0,0 @@
-#!/bin/sh
-RESOURCE_NAME=wx_reload_beijing.jar
-rm -f tpid
-nohup java -jar ./$RESOURCE_NAME --spring.profiles.active=pro &
-echo $! > tpid
-echo Start Success!
-echo
-
-#tpid=`ps -ef|grep $RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
-
-
-
-