瀏覽代碼

mgr 添加一个 restart.sh 重启脚本, 便于在一个子进程内完成 mgr 节点的停止和启动两个操作

reghao 2 月之前
父節點
當前提交
eea511f7ee
共有 1 個文件被更改,包括 21 次插入0 次删除
  1. 21 0
      bin/mgr/restart.sh

+ 21 - 0
bin/mgr/restart.sh

@@ -0,0 +1,21 @@
+#!/bin/bash
+
+app_name='bntweb.jar'
+pid=`ps -ef | grep ${app_name} | grep -v grep | awk '{print $2}'`
+if [[ -z ${pid} ]];
+then
+  echo ${app_name}" killed"
+else
+  echo "kill "${app_name}" with pid "${pid}
+  kill -15 ${pid}
+fi
+
+echo 'sleep 10s to wait process shutdown...'
+sleep 10
+app_dir=`pwd`
+# 使用 mvn clean package -Dmaven.test.skip -Ptest 生成 jar
+# 运行时加载 application.yml 和 bntweb.yml 两个配置文件, 分别位于 classpath 和文件系统路径
+# 外部指定的 bntweb.yml 文件会覆盖 resources/application-test.yml 文件
+java -jar ${app_dir}"/"${app_name} \
+--spring.config.location=classpath:/application.yml,file:${app_dir}/bntweb.yml \
+> console.log 2>&1 &