xiewenjie пре 3 година
родитељ
комит
3d457ee329
1 измењених фајлова са 9 додато и 8 уклоњено
  1. 9 8
      startJar.sh

+ 9 - 8
startJar.sh

@@ -1,4 +1,5 @@
 APP_NAME=changeing-dev.jar
+APP_DEBUG=5526
 
 usage() {
     echo "case: sh run.sh [start|stop|restart|status]"
@@ -11,10 +12,10 @@ is_exist(){
     echo "执行 is_exist 方法"
     pid=`ps -ef|grep $APP_NAME|grep -v grep|awk '{print $2}' ` #根据ps 命令查询当前服务的进程号 赋值给pid"
     if [ -z "${pid}" ]; then #判断pid是否为空
-        echo "pid 等于null"
+        echo "pid 不存在"
         return 1
     else
-        echo "pid 不等于null"
+        echo "pid 存在"
         return 0
     fi
 }
@@ -25,8 +26,8 @@ start(){
     if [ $? -eq "0" ]; then    # [$? -eq "0"] 说明pid不等于空 说明服务正在运行中,将进程号打印出来
         echo "${APP_NAME} running. pid=${pid}"
     else
-        nohup java -jar -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5526 $APP_NAME > logs.log 2>error.log &  # 说明pid为空 执行java -jar 命令启动服务
-        echo "${APP_NAME} started"
+        nohup java -jar -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=${APP_DEBUG} $APP_NAME > logs.log 2>error.log &  # 说明pid为空 执行java -jar 命令启动服务
+        echo "${APP_NAME} started启动"
     fi
 }
 
@@ -36,9 +37,9 @@ stop(){
     is_exist
     if [ $? -eq "0" ]; then    # [$? -eq "0"] 说明pid不等于空 说明服务正在运行中,将进程号杀死
         kill -9 $pid
-        echo "${pid} stopped"
+        echo "${pid} stopped-停止"
     else
-        echo "${APP_NAME} not running"
+        echo "${APP_NAME} 没有运行"
     fi
 }
 
@@ -47,9 +48,9 @@ status(){
     echo "执行 status 方法"
     is_exist
     if [ $? -eq "0" ]; then
-        echo "${APP_NAME} running. Pid is ${pid}"
+        echo "${APP_NAME} running-启动. Pid is ${pid}"
     else
-        echo "${APP_NAME} not running"
+        echo "${APP_NAME} 没有运行"
     fi
 }