Browse Source

更新脚本2

wuweihao 3 years ago
parent
commit
ef83c1dd4f
1 changed files with 4 additions and 11 deletions
  1. 4 11
      run.sh

+ 4 - 11
run.sh

@@ -3,9 +3,8 @@ APP_NAME=wx_lvdao.jar
 APP_PORT=8015
 APP_EVN=$2   #执行环境
 APP_ORDER=$1   #执行方法  start|stop|restart
-APP_OS=linux  # 系统类型 linux|win
-# 获取线程号
-APP_PID=`netstat -ano | grep $APP_PORT | grep LISTENING | awk '{print $5}'`
+# 获取进程号
+APP_PID=`netstat -ntpl | grep $APP_PORT | grep LISTEN | awk '{print $7}' | awk -F "/" '{print $1}'`
 
 
 # 启动命令
@@ -23,16 +22,10 @@ fi
 # 停止命令
 stopApp(){
     echo "执行 stop 方法"
-    if [ ${APP_PID} ]; 
+    if [ ${APP_PID} ];
 	then
 		echo $APP_NAME "存在,执行 stop 方法"
-		if [ ${APP_OS} == "linux" ];
-		then
-			kill -9 ${APP_PID} && echo 'Linux Kill Process!'
-		else
-			cmd "/C TASKKILL /F /PID $APP_PID"
-			echo 'Win Kill Process!'
-		fi
+			kill -9 ${APP_PID} && echo 'Kill Process!'
 	else
 		echo $APP_NAME 没有运行
     fi