refactor: 统一脚本管理,优化Assembly打包配置
- 将各服务脚本统一到项目根目录scripts目录 - Assembly配置引用根目录scripts,避免重复 - 脚本自动从目录名推断服务名称 - 排除docker相关配置文件(application-docker.yml) - 新增env.properties环境变量配置模板 - 更新单机部署文档至v2.1
This commit is contained in:
parent
7a3fcb3ed7
commit
dfce5b0566
@ -6,17 +6,21 @@
|
||||
<includeBaseDirectory>true</includeBaseDirectory>
|
||||
|
||||
<fileSets>
|
||||
<!-- bin目录 - 启动脚本 -->
|
||||
<!-- bin目录 - 启动脚本(引用根目录scripts) -->
|
||||
<fileSet>
|
||||
<directory>src/main/scripts</directory>
|
||||
<directory>${project.basedir}/../scripts</directory>
|
||||
<outputDirectory>bin</outputDirectory>
|
||||
<includes>
|
||||
<include>*.sh</include>
|
||||
<include>start.sh</include>
|
||||
<include>stop.sh</include>
|
||||
<include>restart.sh</include>
|
||||
<include>status.sh</include>
|
||||
<include>env.properties</include>
|
||||
</includes>
|
||||
<fileMode>0755</fileMode>
|
||||
</fileSet>
|
||||
|
||||
<!-- conf目录 - 配置文件 -->
|
||||
<!-- conf目录 - 配置文件(排除docker相关) -->
|
||||
<fileSet>
|
||||
<directory>src/main/resources</directory>
|
||||
<outputDirectory>conf</outputDirectory>
|
||||
@ -25,8 +29,13 @@
|
||||
<include>application-*.yml</include>
|
||||
<include>logback-spring.xml</include>
|
||||
<include>bootstrap.yml</include>
|
||||
<include>*.properties</include>
|
||||
<include>bootstrap-*.yml</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<!-- 排除docker相关配置 -->
|
||||
<exclude>application-docker.yml</exclude>
|
||||
<exclude>bootstrap-docker.yml</exclude>
|
||||
</excludes>
|
||||
<fileMode>0644</fileMode>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
@ -1,6 +1,6 @@
|
||||
# 资金服务平台单机部署文档
|
||||
|
||||
> 版本: v2.0
|
||||
> 版本: v2.1
|
||||
> 更新日期: 2026-02-22
|
||||
> 作者: zhangjf
|
||||
|
||||
@ -387,20 +387,47 @@ mvn clean package -DskipTests
|
||||
|
||||
```
|
||||
fund-sys/
|
||||
├── bin/ # 脚本目录
|
||||
│ ├── start.sh # 启动脚本
|
||||
├── bin/ # 脚本目录(统一从项目根目录scripts引用)
|
||||
│ ├── start.sh # 启动脚本(自动识别服务名)
|
||||
│ ├── stop.sh # 停止脚本
|
||||
│ ├── restart.sh # 重启脚本
|
||||
│ └── status.sh # 状态查看脚本
|
||||
│ ├── status.sh # 状态查看脚本
|
||||
│ └── env.properties # 环境变量配置模板
|
||||
├── lib/ # 依赖JAR目录
|
||||
│ └── fund-sys.jar # 服务JAR包(包含所有依赖)
|
||||
└── conf/ # 配置文件目录
|
||||
└── conf/ # 配置文件目录(排除docker相关配置)
|
||||
├── application.yml # 主配置文件
|
||||
├── application-*.yml # 环境配置文件
|
||||
└── logback-spring.xml # 日志配置文件
|
||||
```
|
||||
|
||||
#### 4.2.3 前端打包
|
||||
#### 4.2.3 Assembly打包配置
|
||||
|
||||
项目使用统一的Assembly配置,脚本统一管理在项目根目录:
|
||||
|
||||
```
|
||||
fundplatform/
|
||||
├── assembly/
|
||||
│ └── assembly.xml # 统一的Assembly配置
|
||||
├── scripts/ # 统一的脚本目录
|
||||
│ ├── start.sh # 启动脚本(自动识别服务名)
|
||||
│ ├── stop.sh # 停止脚本
|
||||
│ ├── restart.sh # 重启脚本
|
||||
│ ├── status.sh # 状态查看脚本
|
||||
│ ├── env.properties # 环境变量配置模板
|
||||
│ ├── start-all.sh # 一键启动所有服务
|
||||
│ ├── stop-all.sh # 一键停止所有服务
|
||||
│ ├── restart-all.sh # 一键重启所有服务
|
||||
│ └── status-all.sh # 查看所有服务状态
|
||||
└── ...各服务模块
|
||||
```
|
||||
|
||||
**Assembly配置特点:**
|
||||
- 脚本从项目根目录 `scripts/` 引用,避免重复
|
||||
- 配置文件排除 `application-docker.yml` 等Docker相关配置
|
||||
- 脚本自动从目录名推断服务名称,无需硬编码
|
||||
|
||||
#### 4.2.4 前端打包
|
||||
|
||||
```bash
|
||||
# 管理后台打包
|
||||
@ -456,11 +483,13 @@ tar -xzf fund-receipt.tar.gz -C /opt/fundplatform/deploy/
|
||||
tar -xzf fund-report.tar.gz -C /opt/fundplatform/deploy/
|
||||
tar -xzf fund-file.tar.gz -C /opt/fundplatform/deploy/
|
||||
|
||||
# 上传一键管理脚本到deploy目录
|
||||
cp /opt/fundplatform/packages/start-all.sh /opt/fundplatform/deploy/
|
||||
cp /opt/fundplatform/packages/stop-all.sh /opt/fundplatform/deploy/
|
||||
cp /opt/fundplatform/packages/restart-all.sh /opt/fundplatform/deploy/
|
||||
cp /opt/fundplatform/packages/status.sh /opt/fundplatform/deploy/
|
||||
```bash
|
||||
# 上传一键管理脚本到deploy目录(在解压服务包后执行)
|
||||
# 一键管理脚本位于项目根目录scripts目录,需要单独上传
|
||||
cp scripts/start-all.sh /opt/fundplatform/deploy/
|
||||
cp scripts/stop-all.sh /opt/fundplatform/deploy/
|
||||
cp scripts/restart-all.sh /opt/fundplatform/deploy/
|
||||
cp scripts/status-all.sh /opt/fundplatform/deploy/
|
||||
```
|
||||
|
||||
### 4.5 配置文件修改
|
||||
|
||||
@ -84,7 +84,7 @@
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||
<descriptor>${project.basedir}/../assembly/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 服务重启脚本
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
${SCRIPT_DIR}/stop.sh
|
||||
sleep 3
|
||||
${SCRIPT_DIR}/start.sh
|
||||
@ -1,36 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 服务启动脚本
|
||||
APP_NAME="fund-cust"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
LOG_HOME="/datacfs/applogs/${APP_NAME}"
|
||||
JAR_FILE="${APP_HOME}/lib/${APP_NAME}.jar"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# JVM参数
|
||||
JAVA_OPTS="-Xms256m -Xmx512m -XX:+UseG1GC -XX:MaxGCPauseMillis=200"
|
||||
|
||||
# 日志参数
|
||||
LOG_OPTS="-Dlogging.file.path=${LOG_HOME} -DAPP_NAME=${APP_NAME}"
|
||||
|
||||
# 配置文件路径
|
||||
CONFIG_OPTS="--spring.config.location=${APP_HOME}/conf/application.yml"
|
||||
|
||||
# 检查是否已运行
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
PID=$(cat $PID_FILE)
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo "${APP_NAME} is already running (PID: $PID)"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# 创建日志目录
|
||||
mkdir -p ${LOG_HOME}
|
||||
|
||||
# 启动服务
|
||||
echo "Starting ${APP_NAME}..."
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE $CONFIG_OPTS > /dev/null 2>&1 &
|
||||
|
||||
# 保存PID
|
||||
echo $\! > $PID_FILE
|
||||
echo "${APP_NAME} started (PID: $(cat $PID_FILE))"
|
||||
@ -1,25 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 查看服务状态
|
||||
APP_NAME="fund-cust"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
echo "=========================================="
|
||||
echo " Service: ${APP_NAME}"
|
||||
echo "=========================================="
|
||||
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
PID=$(cat $PID_FILE)
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo -e "Status: \033[32mRUNNING\033[0m"
|
||||
echo "PID: ${PID}"
|
||||
ps -p $PID -o pid,ppid,%cpu,%mem,etime,cmd --no-headers 2>/dev/null
|
||||
else
|
||||
echo -e "Status: \033[31mSTOPPED\033[0m (stale PID file)"
|
||||
rm -f $PID_FILE
|
||||
fi
|
||||
else
|
||||
echo -e "Status: \033[31mSTOPPED\033[0m"
|
||||
fi
|
||||
|
||||
echo "=========================================="
|
||||
@ -1,39 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 服务停止脚本
|
||||
APP_NAME="fund-cust"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# 检查是否运行
|
||||
if [ \! -f "$PID_FILE" ]; then
|
||||
echo "${APP_NAME} is not running"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
PID=$(cat $PID_FILE)
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
echo "${APP_NAME} is not running"
|
||||
rm -f $PID_FILE
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 停止服务
|
||||
echo "Stopping ${APP_NAME} (PID: $PID)..."
|
||||
kill $PID
|
||||
|
||||
# 等待停止
|
||||
for i in {1..30}; do
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# 强制停止
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo "Force killing ${APP_NAME}..."
|
||||
kill -9 $PID
|
||||
fi
|
||||
|
||||
rm -f $PID_FILE
|
||||
echo "${APP_NAME} stopped"
|
||||
@ -76,7 +76,7 @@
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||
<descriptor>${project.basedir}/../assembly/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
|
||||
@ -1,43 +0,0 @@
|
||||
<assembly>
|
||||
<id>bin</id>
|
||||
<formats>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>true</includeBaseDirectory>
|
||||
|
||||
<fileSets>
|
||||
<!-- bin目录 - 启动脚本 -->
|
||||
<fileSet>
|
||||
<directory>src/main/scripts</directory>
|
||||
<outputDirectory>bin</outputDirectory>
|
||||
<includes>
|
||||
<include>*.sh</include>
|
||||
</includes>
|
||||
<fileMode>0755</fileMode>
|
||||
</fileSet>
|
||||
|
||||
<!-- conf目录 - 配置文件 -->
|
||||
<fileSet>
|
||||
<directory>src/main/resources</directory>
|
||||
<outputDirectory>conf</outputDirectory>
|
||||
<includes>
|
||||
<include>application.yml</include>
|
||||
<include>application-*.yml</include>
|
||||
<include>logback-spring.xml</include>
|
||||
<include>bootstrap.yml</include>
|
||||
<include>*.properties</include>
|
||||
</includes>
|
||||
<fileMode>0644</fileMode>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
|
||||
<dependencySets>
|
||||
<!-- lib目录 - 所有依赖JAR -->
|
||||
<dependencySet>
|
||||
<outputDirectory>lib</outputDirectory>
|
||||
<useProjectArtifact>true</useProjectArtifact>
|
||||
<scope>runtime</scope>
|
||||
<fileMode>0644</fileMode>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
</assembly>
|
||||
@ -1,7 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 服务重启脚本
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
${SCRIPT_DIR}/stop.sh
|
||||
sleep 3
|
||||
${SCRIPT_DIR}/start.sh
|
||||
@ -1,36 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 服务启动脚本
|
||||
APP_NAME="fund-exp"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
LOG_HOME="/datacfs/applogs/${APP_NAME}"
|
||||
JAR_FILE="${APP_HOME}/lib/${APP_NAME}.jar"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# JVM参数
|
||||
JAVA_OPTS="-Xms256m -Xmx512m -XX:+UseG1GC -XX:MaxGCPauseMillis=200"
|
||||
|
||||
# 日志参数
|
||||
LOG_OPTS="-Dlogging.file.path=${LOG_HOME} -DAPP_NAME=${APP_NAME}"
|
||||
|
||||
# 配置文件路径
|
||||
CONFIG_OPTS="--spring.config.location=${APP_HOME}/conf/application.yml"
|
||||
|
||||
# 检查是否已运行
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
PID=$(cat $PID_FILE)
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo "${APP_NAME} is already running (PID: $PID)"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# 创建日志目录
|
||||
mkdir -p ${LOG_HOME}
|
||||
|
||||
# 启动服务
|
||||
echo "Starting ${APP_NAME}..."
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE $CONFIG_OPTS > /dev/null 2>&1 &
|
||||
|
||||
# 保存PID
|
||||
echo $\! > $PID_FILE
|
||||
echo "${APP_NAME} started (PID: $(cat $PID_FILE))"
|
||||
@ -1,25 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 查看服务状态
|
||||
APP_NAME="fund-exp"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
echo "=========================================="
|
||||
echo " Service: ${APP_NAME}"
|
||||
echo "=========================================="
|
||||
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
PID=$(cat $PID_FILE)
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo -e "Status: \033[32mRUNNING\033[0m"
|
||||
echo "PID: ${PID}"
|
||||
ps -p $PID -o pid,ppid,%cpu,%mem,etime,cmd --no-headers 2>/dev/null
|
||||
else
|
||||
echo -e "Status: \033[31mSTOPPED\033[0m (stale PID file)"
|
||||
rm -f $PID_FILE
|
||||
fi
|
||||
else
|
||||
echo -e "Status: \033[31mSTOPPED\033[0m"
|
||||
fi
|
||||
|
||||
echo "=========================================="
|
||||
@ -1,39 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 服务停止脚本
|
||||
APP_NAME="fund-exp"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# 检查是否运行
|
||||
if [ \! -f "$PID_FILE" ]; then
|
||||
echo "${APP_NAME} is not running"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
PID=$(cat $PID_FILE)
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
echo "${APP_NAME} is not running"
|
||||
rm -f $PID_FILE
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 停止服务
|
||||
echo "Stopping ${APP_NAME} (PID: $PID)..."
|
||||
kill $PID
|
||||
|
||||
# 等待停止
|
||||
for i in {1..30}; do
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# 强制停止
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo "Force killing ${APP_NAME}..."
|
||||
kill -9 $PID
|
||||
fi
|
||||
|
||||
rm -f $PID_FILE
|
||||
echo "${APP_NAME} stopped"
|
||||
@ -82,7 +82,7 @@
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||
<descriptor>${project.basedir}/../assembly/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
|
||||
@ -1,43 +0,0 @@
|
||||
<assembly>
|
||||
<id>bin</id>
|
||||
<formats>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>true</includeBaseDirectory>
|
||||
|
||||
<fileSets>
|
||||
<!-- bin目录 - 启动脚本 -->
|
||||
<fileSet>
|
||||
<directory>src/main/scripts</directory>
|
||||
<outputDirectory>bin</outputDirectory>
|
||||
<includes>
|
||||
<include>*.sh</include>
|
||||
</includes>
|
||||
<fileMode>0755</fileMode>
|
||||
</fileSet>
|
||||
|
||||
<!-- conf目录 - 配置文件 -->
|
||||
<fileSet>
|
||||
<directory>src/main/resources</directory>
|
||||
<outputDirectory>conf</outputDirectory>
|
||||
<includes>
|
||||
<include>application.yml</include>
|
||||
<include>application-*.yml</include>
|
||||
<include>logback-spring.xml</include>
|
||||
<include>bootstrap.yml</include>
|
||||
<include>*.properties</include>
|
||||
</includes>
|
||||
<fileMode>0644</fileMode>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
|
||||
<dependencySets>
|
||||
<!-- lib目录 - 所有依赖JAR -->
|
||||
<dependencySet>
|
||||
<outputDirectory>lib</outputDirectory>
|
||||
<useProjectArtifact>true</useProjectArtifact>
|
||||
<scope>runtime</scope>
|
||||
<fileMode>0644</fileMode>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
</assembly>
|
||||
@ -1,7 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 服务重启脚本
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
${SCRIPT_DIR}/stop.sh
|
||||
sleep 3
|
||||
${SCRIPT_DIR}/start.sh
|
||||
@ -1,36 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 服务启动脚本
|
||||
APP_NAME="fund-file"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
LOG_HOME="/datacfs/applogs/${APP_NAME}"
|
||||
JAR_FILE="${APP_HOME}/lib/${APP_NAME}.jar"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# JVM参数
|
||||
JAVA_OPTS="-Xms256m -Xmx512m -XX:+UseG1GC -XX:MaxGCPauseMillis=200"
|
||||
|
||||
# 日志参数
|
||||
LOG_OPTS="-Dlogging.file.path=${LOG_HOME} -DAPP_NAME=${APP_NAME}"
|
||||
|
||||
# 配置文件路径
|
||||
CONFIG_OPTS="--spring.config.location=${APP_HOME}/conf/application.yml"
|
||||
|
||||
# 检查是否已运行
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
PID=$(cat $PID_FILE)
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo "${APP_NAME} is already running (PID: $PID)"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# 创建日志目录
|
||||
mkdir -p ${LOG_HOME}
|
||||
|
||||
# 启动服务
|
||||
echo "Starting ${APP_NAME}..."
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE $CONFIG_OPTS > /dev/null 2>&1 &
|
||||
|
||||
# 保存PID
|
||||
echo $\! > $PID_FILE
|
||||
echo "${APP_NAME} started (PID: $(cat $PID_FILE))"
|
||||
@ -1,25 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 查看服务状态
|
||||
APP_NAME="fund-file"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
echo "=========================================="
|
||||
echo " Service: ${APP_NAME}"
|
||||
echo "=========================================="
|
||||
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
PID=$(cat $PID_FILE)
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo -e "Status: \033[32mRUNNING\033[0m"
|
||||
echo "PID: ${PID}"
|
||||
ps -p $PID -o pid,ppid,%cpu,%mem,etime,cmd --no-headers 2>/dev/null
|
||||
else
|
||||
echo -e "Status: \033[31mSTOPPED\033[0m (stale PID file)"
|
||||
rm -f $PID_FILE
|
||||
fi
|
||||
else
|
||||
echo -e "Status: \033[31mSTOPPED\033[0m"
|
||||
fi
|
||||
|
||||
echo "=========================================="
|
||||
@ -1,39 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 服务停止脚本
|
||||
APP_NAME="fund-file"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# 检查是否运行
|
||||
if [ \! -f "$PID_FILE" ]; then
|
||||
echo "${APP_NAME} is not running"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
PID=$(cat $PID_FILE)
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
echo "${APP_NAME} is not running"
|
||||
rm -f $PID_FILE
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 停止服务
|
||||
echo "Stopping ${APP_NAME} (PID: $PID)..."
|
||||
kill $PID
|
||||
|
||||
# 等待停止
|
||||
for i in {1..30}; do
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# 强制停止
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo "Force killing ${APP_NAME}..."
|
||||
kill -9 $PID
|
||||
fi
|
||||
|
||||
rm -f $PID_FILE
|
||||
echo "${APP_NAME} stopped"
|
||||
@ -87,7 +87,7 @@
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||
<descriptor>${project.basedir}/../assembly/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
|
||||
@ -1,43 +0,0 @@
|
||||
<assembly>
|
||||
<id>bin</id>
|
||||
<formats>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>true</includeBaseDirectory>
|
||||
|
||||
<fileSets>
|
||||
<!-- bin目录 - 启动脚本 -->
|
||||
<fileSet>
|
||||
<directory>src/main/scripts</directory>
|
||||
<outputDirectory>bin</outputDirectory>
|
||||
<includes>
|
||||
<include>*.sh</include>
|
||||
</includes>
|
||||
<fileMode>0755</fileMode>
|
||||
</fileSet>
|
||||
|
||||
<!-- conf目录 - 配置文件 -->
|
||||
<fileSet>
|
||||
<directory>src/main/resources</directory>
|
||||
<outputDirectory>conf</outputDirectory>
|
||||
<includes>
|
||||
<include>application.yml</include>
|
||||
<include>application-*.yml</include>
|
||||
<include>logback-spring.xml</include>
|
||||
<include>bootstrap.yml</include>
|
||||
<include>*.properties</include>
|
||||
</includes>
|
||||
<fileMode>0644</fileMode>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
|
||||
<dependencySets>
|
||||
<!-- lib目录 - 所有依赖JAR -->
|
||||
<dependencySet>
|
||||
<outputDirectory>lib</outputDirectory>
|
||||
<useProjectArtifact>true</useProjectArtifact>
|
||||
<scope>runtime</scope>
|
||||
<fileMode>0644</fileMode>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
</assembly>
|
||||
@ -1,7 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 服务重启脚本
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
${SCRIPT_DIR}/stop.sh
|
||||
sleep 3
|
||||
${SCRIPT_DIR}/start.sh
|
||||
@ -1,36 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 服务启动脚本
|
||||
APP_NAME="fund-gateway"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
LOG_HOME="/datacfs/applogs/${APP_NAME}"
|
||||
JAR_FILE="${APP_HOME}/lib/${APP_NAME}.jar"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# JVM参数
|
||||
JAVA_OPTS="-Xms256m -Xmx512m -XX:+UseG1GC -XX:MaxGCPauseMillis=200"
|
||||
|
||||
# 日志参数
|
||||
LOG_OPTS="-Dlogging.file.path=${LOG_HOME} -DAPP_NAME=${APP_NAME}"
|
||||
|
||||
# 配置文件路径
|
||||
CONFIG_OPTS="--spring.config.location=${APP_HOME}/conf/application.yml"
|
||||
|
||||
# 检查是否已运行
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
PID=$(cat $PID_FILE)
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo "${APP_NAME} is already running (PID: $PID)"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# 创建日志目录
|
||||
mkdir -p ${LOG_HOME}
|
||||
|
||||
# 启动服务
|
||||
echo "Starting ${APP_NAME}..."
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE $CONFIG_OPTS > /dev/null 2>&1 &
|
||||
|
||||
# 保存PID
|
||||
echo $\! > $PID_FILE
|
||||
echo "${APP_NAME} started (PID: $(cat $PID_FILE))"
|
||||
@ -1,25 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 查看服务状态
|
||||
APP_NAME="fund-gateway"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
echo "=========================================="
|
||||
echo " Service: ${APP_NAME}"
|
||||
echo "=========================================="
|
||||
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
PID=$(cat $PID_FILE)
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo -e "Status: \033[32mRUNNING\033[0m"
|
||||
echo "PID: ${PID}"
|
||||
ps -p $PID -o pid,ppid,%cpu,%mem,etime,cmd --no-headers 2>/dev/null
|
||||
else
|
||||
echo -e "Status: \033[31mSTOPPED\033[0m (stale PID file)"
|
||||
rm -f $PID_FILE
|
||||
fi
|
||||
else
|
||||
echo -e "Status: \033[31mSTOPPED\033[0m"
|
||||
fi
|
||||
|
||||
echo "=========================================="
|
||||
@ -1,39 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 服务停止脚本
|
||||
APP_NAME="fund-gateway"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# 检查是否运行
|
||||
if [ \! -f "$PID_FILE" ]; then
|
||||
echo "${APP_NAME} is not running"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
PID=$(cat $PID_FILE)
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
echo "${APP_NAME} is not running"
|
||||
rm -f $PID_FILE
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 停止服务
|
||||
echo "Stopping ${APP_NAME} (PID: $PID)..."
|
||||
kill $PID
|
||||
|
||||
# 等待停止
|
||||
for i in {1..30}; do
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# 强制停止
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo "Force killing ${APP_NAME}..."
|
||||
kill -9 $PID
|
||||
fi
|
||||
|
||||
rm -f $PID_FILE
|
||||
echo "${APP_NAME} stopped"
|
||||
@ -76,7 +76,7 @@
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||
<descriptor>${project.basedir}/../assembly/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
|
||||
@ -1,43 +0,0 @@
|
||||
<assembly>
|
||||
<id>bin</id>
|
||||
<formats>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>true</includeBaseDirectory>
|
||||
|
||||
<fileSets>
|
||||
<!-- bin目录 - 启动脚本 -->
|
||||
<fileSet>
|
||||
<directory>src/main/scripts</directory>
|
||||
<outputDirectory>bin</outputDirectory>
|
||||
<includes>
|
||||
<include>*.sh</include>
|
||||
</includes>
|
||||
<fileMode>0755</fileMode>
|
||||
</fileSet>
|
||||
|
||||
<!-- conf目录 - 配置文件 -->
|
||||
<fileSet>
|
||||
<directory>src/main/resources</directory>
|
||||
<outputDirectory>conf</outputDirectory>
|
||||
<includes>
|
||||
<include>application.yml</include>
|
||||
<include>application-*.yml</include>
|
||||
<include>logback-spring.xml</include>
|
||||
<include>bootstrap.yml</include>
|
||||
<include>*.properties</include>
|
||||
</includes>
|
||||
<fileMode>0644</fileMode>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
|
||||
<dependencySets>
|
||||
<!-- lib目录 - 所有依赖JAR -->
|
||||
<dependencySet>
|
||||
<outputDirectory>lib</outputDirectory>
|
||||
<useProjectArtifact>true</useProjectArtifact>
|
||||
<scope>runtime</scope>
|
||||
<fileMode>0644</fileMode>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
</assembly>
|
||||
@ -1,7 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 服务重启脚本
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
${SCRIPT_DIR}/stop.sh
|
||||
sleep 3
|
||||
${SCRIPT_DIR}/start.sh
|
||||
@ -1,36 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 服务启动脚本
|
||||
APP_NAME="fund-proj"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
LOG_HOME="/datacfs/applogs/${APP_NAME}"
|
||||
JAR_FILE="${APP_HOME}/lib/${APP_NAME}.jar"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# JVM参数
|
||||
JAVA_OPTS="-Xms256m -Xmx512m -XX:+UseG1GC -XX:MaxGCPauseMillis=200"
|
||||
|
||||
# 日志参数
|
||||
LOG_OPTS="-Dlogging.file.path=${LOG_HOME} -DAPP_NAME=${APP_NAME}"
|
||||
|
||||
# 配置文件路径
|
||||
CONFIG_OPTS="--spring.config.location=${APP_HOME}/conf/application.yml"
|
||||
|
||||
# 检查是否已运行
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
PID=$(cat $PID_FILE)
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo "${APP_NAME} is already running (PID: $PID)"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# 创建日志目录
|
||||
mkdir -p ${LOG_HOME}
|
||||
|
||||
# 启动服务
|
||||
echo "Starting ${APP_NAME}..."
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE $CONFIG_OPTS > /dev/null 2>&1 &
|
||||
|
||||
# 保存PID
|
||||
echo $\! > $PID_FILE
|
||||
echo "${APP_NAME} started (PID: $(cat $PID_FILE))"
|
||||
@ -1,25 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 查看服务状态
|
||||
APP_NAME="fund-proj"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
echo "=========================================="
|
||||
echo " Service: ${APP_NAME}"
|
||||
echo "=========================================="
|
||||
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
PID=$(cat $PID_FILE)
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo -e "Status: \033[32mRUNNING\033[0m"
|
||||
echo "PID: ${PID}"
|
||||
ps -p $PID -o pid,ppid,%cpu,%mem,etime,cmd --no-headers 2>/dev/null
|
||||
else
|
||||
echo -e "Status: \033[31mSTOPPED\033[0m (stale PID file)"
|
||||
rm -f $PID_FILE
|
||||
fi
|
||||
else
|
||||
echo -e "Status: \033[31mSTOPPED\033[0m"
|
||||
fi
|
||||
|
||||
echo "=========================================="
|
||||
@ -1,39 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 服务停止脚本
|
||||
APP_NAME="fund-proj"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# 检查是否运行
|
||||
if [ \! -f "$PID_FILE" ]; then
|
||||
echo "${APP_NAME} is not running"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
PID=$(cat $PID_FILE)
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
echo "${APP_NAME} is not running"
|
||||
rm -f $PID_FILE
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 停止服务
|
||||
echo "Stopping ${APP_NAME} (PID: $PID)..."
|
||||
kill $PID
|
||||
|
||||
# 等待停止
|
||||
for i in {1..30}; do
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# 强制停止
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo "Force killing ${APP_NAME}..."
|
||||
kill -9 $PID
|
||||
fi
|
||||
|
||||
rm -f $PID_FILE
|
||||
echo "${APP_NAME} stopped"
|
||||
@ -76,7 +76,7 @@
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||
<descriptor>${project.basedir}/../assembly/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
|
||||
@ -1,43 +0,0 @@
|
||||
<assembly>
|
||||
<id>bin</id>
|
||||
<formats>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>true</includeBaseDirectory>
|
||||
|
||||
<fileSets>
|
||||
<!-- bin目录 - 启动脚本 -->
|
||||
<fileSet>
|
||||
<directory>src/main/scripts</directory>
|
||||
<outputDirectory>bin</outputDirectory>
|
||||
<includes>
|
||||
<include>*.sh</include>
|
||||
</includes>
|
||||
<fileMode>0755</fileMode>
|
||||
</fileSet>
|
||||
|
||||
<!-- conf目录 - 配置文件 -->
|
||||
<fileSet>
|
||||
<directory>src/main/resources</directory>
|
||||
<outputDirectory>conf</outputDirectory>
|
||||
<includes>
|
||||
<include>application.yml</include>
|
||||
<include>application-*.yml</include>
|
||||
<include>logback-spring.xml</include>
|
||||
<include>bootstrap.yml</include>
|
||||
<include>*.properties</include>
|
||||
</includes>
|
||||
<fileMode>0644</fileMode>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
|
||||
<dependencySets>
|
||||
<!-- lib目录 - 所有依赖JAR -->
|
||||
<dependencySet>
|
||||
<outputDirectory>lib</outputDirectory>
|
||||
<useProjectArtifact>true</useProjectArtifact>
|
||||
<scope>runtime</scope>
|
||||
<fileMode>0644</fileMode>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
</assembly>
|
||||
@ -1,7 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 服务重启脚本
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
${SCRIPT_DIR}/stop.sh
|
||||
sleep 3
|
||||
${SCRIPT_DIR}/start.sh
|
||||
@ -1,36 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 服务启动脚本
|
||||
APP_NAME="fund-receipt"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
LOG_HOME="/datacfs/applogs/${APP_NAME}"
|
||||
JAR_FILE="${APP_HOME}/lib/${APP_NAME}.jar"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# JVM参数
|
||||
JAVA_OPTS="-Xms256m -Xmx512m -XX:+UseG1GC -XX:MaxGCPauseMillis=200"
|
||||
|
||||
# 日志参数
|
||||
LOG_OPTS="-Dlogging.file.path=${LOG_HOME} -DAPP_NAME=${APP_NAME}"
|
||||
|
||||
# 配置文件路径
|
||||
CONFIG_OPTS="--spring.config.location=${APP_HOME}/conf/application.yml"
|
||||
|
||||
# 检查是否已运行
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
PID=$(cat $PID_FILE)
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo "${APP_NAME} is already running (PID: $PID)"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# 创建日志目录
|
||||
mkdir -p ${LOG_HOME}
|
||||
|
||||
# 启动服务
|
||||
echo "Starting ${APP_NAME}..."
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE $CONFIG_OPTS > /dev/null 2>&1 &
|
||||
|
||||
# 保存PID
|
||||
echo $\! > $PID_FILE
|
||||
echo "${APP_NAME} started (PID: $(cat $PID_FILE))"
|
||||
@ -1,25 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 查看服务状态
|
||||
APP_NAME="fund-receipt"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
echo "=========================================="
|
||||
echo " Service: ${APP_NAME}"
|
||||
echo "=========================================="
|
||||
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
PID=$(cat $PID_FILE)
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo -e "Status: \033[32mRUNNING\033[0m"
|
||||
echo "PID: ${PID}"
|
||||
ps -p $PID -o pid,ppid,%cpu,%mem,etime,cmd --no-headers 2>/dev/null
|
||||
else
|
||||
echo -e "Status: \033[31mSTOPPED\033[0m (stale PID file)"
|
||||
rm -f $PID_FILE
|
||||
fi
|
||||
else
|
||||
echo -e "Status: \033[31mSTOPPED\033[0m"
|
||||
fi
|
||||
|
||||
echo "=========================================="
|
||||
@ -1,39 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 服务停止脚本
|
||||
APP_NAME="fund-receipt"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# 检查是否运行
|
||||
if [ \! -f "$PID_FILE" ]; then
|
||||
echo "${APP_NAME} is not running"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
PID=$(cat $PID_FILE)
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
echo "${APP_NAME} is not running"
|
||||
rm -f $PID_FILE
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 停止服务
|
||||
echo "Stopping ${APP_NAME} (PID: $PID)..."
|
||||
kill $PID
|
||||
|
||||
# 等待停止
|
||||
for i in {1..30}; do
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# 强制停止
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo "Force killing ${APP_NAME}..."
|
||||
kill -9 $PID
|
||||
fi
|
||||
|
||||
rm -f $PID_FILE
|
||||
echo "${APP_NAME} stopped"
|
||||
@ -81,7 +81,7 @@
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||
<descriptor>${project.basedir}/../assembly/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
|
||||
@ -1,43 +0,0 @@
|
||||
<assembly>
|
||||
<id>bin</id>
|
||||
<formats>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>true</includeBaseDirectory>
|
||||
|
||||
<fileSets>
|
||||
<!-- bin目录 - 启动脚本 -->
|
||||
<fileSet>
|
||||
<directory>src/main/scripts</directory>
|
||||
<outputDirectory>bin</outputDirectory>
|
||||
<includes>
|
||||
<include>*.sh</include>
|
||||
</includes>
|
||||
<fileMode>0755</fileMode>
|
||||
</fileSet>
|
||||
|
||||
<!-- conf目录 - 配置文件 -->
|
||||
<fileSet>
|
||||
<directory>src/main/resources</directory>
|
||||
<outputDirectory>conf</outputDirectory>
|
||||
<includes>
|
||||
<include>application.yml</include>
|
||||
<include>application-*.yml</include>
|
||||
<include>logback-spring.xml</include>
|
||||
<include>bootstrap.yml</include>
|
||||
<include>*.properties</include>
|
||||
</includes>
|
||||
<fileMode>0644</fileMode>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
|
||||
<dependencySets>
|
||||
<!-- lib目录 - 所有依赖JAR -->
|
||||
<dependencySet>
|
||||
<outputDirectory>lib</outputDirectory>
|
||||
<useProjectArtifact>true</useProjectArtifact>
|
||||
<scope>runtime</scope>
|
||||
<fileMode>0644</fileMode>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
</assembly>
|
||||
@ -1,7 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 服务重启脚本
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
${SCRIPT_DIR}/stop.sh
|
||||
sleep 3
|
||||
${SCRIPT_DIR}/start.sh
|
||||
@ -1,36 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 服务启动脚本
|
||||
APP_NAME="fund-report"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
LOG_HOME="/datacfs/applogs/${APP_NAME}"
|
||||
JAR_FILE="${APP_HOME}/lib/${APP_NAME}.jar"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# JVM参数
|
||||
JAVA_OPTS="-Xms256m -Xmx512m -XX:+UseG1GC -XX:MaxGCPauseMillis=200"
|
||||
|
||||
# 日志参数
|
||||
LOG_OPTS="-Dlogging.file.path=${LOG_HOME} -DAPP_NAME=${APP_NAME}"
|
||||
|
||||
# 配置文件路径
|
||||
CONFIG_OPTS="--spring.config.location=${APP_HOME}/conf/application.yml"
|
||||
|
||||
# 检查是否已运行
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
PID=$(cat $PID_FILE)
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo "${APP_NAME} is already running (PID: $PID)"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# 创建日志目录
|
||||
mkdir -p ${LOG_HOME}
|
||||
|
||||
# 启动服务
|
||||
echo "Starting ${APP_NAME}..."
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE $CONFIG_OPTS > /dev/null 2>&1 &
|
||||
|
||||
# 保存PID
|
||||
echo $\! > $PID_FILE
|
||||
echo "${APP_NAME} started (PID: $(cat $PID_FILE))"
|
||||
@ -1,25 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 查看服务状态
|
||||
APP_NAME="fund-report"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
echo "=========================================="
|
||||
echo " Service: ${APP_NAME}"
|
||||
echo "=========================================="
|
||||
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
PID=$(cat $PID_FILE)
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo -e "Status: \033[32mRUNNING\033[0m"
|
||||
echo "PID: ${PID}"
|
||||
ps -p $PID -o pid,ppid,%cpu,%mem,etime,cmd --no-headers 2>/dev/null
|
||||
else
|
||||
echo -e "Status: \033[31mSTOPPED\033[0m (stale PID file)"
|
||||
rm -f $PID_FILE
|
||||
fi
|
||||
else
|
||||
echo -e "Status: \033[31mSTOPPED\033[0m"
|
||||
fi
|
||||
|
||||
echo "=========================================="
|
||||
@ -1,39 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 服务停止脚本
|
||||
APP_NAME="fund-report"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# 检查是否运行
|
||||
if [ \! -f "$PID_FILE" ]; then
|
||||
echo "${APP_NAME} is not running"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
PID=$(cat $PID_FILE)
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
echo "${APP_NAME} is not running"
|
||||
rm -f $PID_FILE
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 停止服务
|
||||
echo "Stopping ${APP_NAME} (PID: $PID)..."
|
||||
kill $PID
|
||||
|
||||
# 等待停止
|
||||
for i in {1..30}; do
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# 强制停止
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo "Force killing ${APP_NAME}..."
|
||||
kill -9 $PID
|
||||
fi
|
||||
|
||||
rm -f $PID_FILE
|
||||
echo "${APP_NAME} stopped"
|
||||
@ -76,7 +76,7 @@
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||
<descriptor>${project.basedir}/../assembly/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
|
||||
@ -1,43 +0,0 @@
|
||||
<assembly>
|
||||
<id>bin</id>
|
||||
<formats>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>true</includeBaseDirectory>
|
||||
|
||||
<fileSets>
|
||||
<!-- bin目录 - 启动脚本 -->
|
||||
<fileSet>
|
||||
<directory>src/main/scripts</directory>
|
||||
<outputDirectory>bin</outputDirectory>
|
||||
<includes>
|
||||
<include>*.sh</include>
|
||||
</includes>
|
||||
<fileMode>0755</fileMode>
|
||||
</fileSet>
|
||||
|
||||
<!-- conf目录 - 配置文件 -->
|
||||
<fileSet>
|
||||
<directory>src/main/resources</directory>
|
||||
<outputDirectory>conf</outputDirectory>
|
||||
<includes>
|
||||
<include>application.yml</include>
|
||||
<include>application-*.yml</include>
|
||||
<include>logback-spring.xml</include>
|
||||
<include>bootstrap.yml</include>
|
||||
<include>*.properties</include>
|
||||
</includes>
|
||||
<fileMode>0644</fileMode>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
|
||||
<dependencySets>
|
||||
<!-- lib目录 - 所有依赖JAR -->
|
||||
<dependencySet>
|
||||
<outputDirectory>lib</outputDirectory>
|
||||
<useProjectArtifact>true</useProjectArtifact>
|
||||
<scope>runtime</scope>
|
||||
<fileMode>0644</fileMode>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
</assembly>
|
||||
@ -1,7 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 服务重启脚本
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
${SCRIPT_DIR}/stop.sh
|
||||
sleep 3
|
||||
${SCRIPT_DIR}/start.sh
|
||||
@ -1,36 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 服务启动脚本
|
||||
APP_NAME="fund-req"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
LOG_HOME="/datacfs/applogs/${APP_NAME}"
|
||||
JAR_FILE="${APP_HOME}/lib/${APP_NAME}.jar"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# JVM参数
|
||||
JAVA_OPTS="-Xms256m -Xmx512m -XX:+UseG1GC -XX:MaxGCPauseMillis=200"
|
||||
|
||||
# 日志参数
|
||||
LOG_OPTS="-Dlogging.file.path=${LOG_HOME} -DAPP_NAME=${APP_NAME}"
|
||||
|
||||
# 配置文件路径
|
||||
CONFIG_OPTS="--spring.config.location=${APP_HOME}/conf/application.yml"
|
||||
|
||||
# 检查是否已运行
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
PID=$(cat $PID_FILE)
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo "${APP_NAME} is already running (PID: $PID)"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# 创建日志目录
|
||||
mkdir -p ${LOG_HOME}
|
||||
|
||||
# 启动服务
|
||||
echo "Starting ${APP_NAME}..."
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE $CONFIG_OPTS > /dev/null 2>&1 &
|
||||
|
||||
# 保存PID
|
||||
echo $\! > $PID_FILE
|
||||
echo "${APP_NAME} started (PID: $(cat $PID_FILE))"
|
||||
@ -1,25 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 查看服务状态
|
||||
APP_NAME="fund-req"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
echo "=========================================="
|
||||
echo " Service: ${APP_NAME}"
|
||||
echo "=========================================="
|
||||
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
PID=$(cat $PID_FILE)
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo -e "Status: \033[32mRUNNING\033[0m"
|
||||
echo "PID: ${PID}"
|
||||
ps -p $PID -o pid,ppid,%cpu,%mem,etime,cmd --no-headers 2>/dev/null
|
||||
else
|
||||
echo -e "Status: \033[31mSTOPPED\033[0m (stale PID file)"
|
||||
rm -f $PID_FILE
|
||||
fi
|
||||
else
|
||||
echo -e "Status: \033[31mSTOPPED\033[0m"
|
||||
fi
|
||||
|
||||
echo "=========================================="
|
||||
@ -1,39 +0,0 @@
|
||||
#\!/bin/bash
|
||||
# 服务停止脚本
|
||||
APP_NAME="fund-req"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# 检查是否运行
|
||||
if [ \! -f "$PID_FILE" ]; then
|
||||
echo "${APP_NAME} is not running"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
PID=$(cat $PID_FILE)
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
echo "${APP_NAME} is not running"
|
||||
rm -f $PID_FILE
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 停止服务
|
||||
echo "Stopping ${APP_NAME} (PID: $PID)..."
|
||||
kill $PID
|
||||
|
||||
# 等待停止
|
||||
for i in {1..30}; do
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# 强制停止
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo "Force killing ${APP_NAME}..."
|
||||
kill -9 $PID
|
||||
fi
|
||||
|
||||
rm -f $PID_FILE
|
||||
echo "${APP_NAME} stopped"
|
||||
@ -125,7 +125,7 @@
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||
<descriptor>${project.basedir}/../assembly/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
|
||||
@ -1,43 +0,0 @@
|
||||
<assembly>
|
||||
<id>bin</id>
|
||||
<formats>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>true</includeBaseDirectory>
|
||||
|
||||
<fileSets>
|
||||
<!-- bin目录 - 启动脚本 -->
|
||||
<fileSet>
|
||||
<directory>src/main/scripts</directory>
|
||||
<outputDirectory>bin</outputDirectory>
|
||||
<includes>
|
||||
<include>*.sh</include>
|
||||
</includes>
|
||||
<fileMode>0755</fileMode>
|
||||
</fileSet>
|
||||
|
||||
<!-- conf目录 - 配置文件 -->
|
||||
<fileSet>
|
||||
<directory>src/main/resources</directory>
|
||||
<outputDirectory>conf</outputDirectory>
|
||||
<includes>
|
||||
<include>application.yml</include>
|
||||
<include>application-*.yml</include>
|
||||
<include>logback-spring.xml</include>
|
||||
<include>bootstrap.yml</include>
|
||||
<include>*.properties</include>
|
||||
</includes>
|
||||
<fileMode>0644</fileMode>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
|
||||
<dependencySets>
|
||||
<!-- lib目录 - 所有依赖JAR -->
|
||||
<dependencySet>
|
||||
<outputDirectory>lib</outputDirectory>
|
||||
<useProjectArtifact>true</useProjectArtifact>
|
||||
<scope>runtime</scope>
|
||||
<fileMode>0644</fileMode>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
</assembly>
|
||||
22
scripts/env.properties
Normal file
22
scripts/env.properties
Normal file
@ -0,0 +1,22 @@
|
||||
# ============================================
|
||||
# 环境变量配置文件
|
||||
# 服务启动时会加载此文件
|
||||
# ============================================
|
||||
|
||||
# JVM参数配置
|
||||
# JAVA_OPTS="-Xms256m -Xmx512m -XX:+UseG1GC -XX:MaxGCPauseMillis=200"
|
||||
|
||||
# 数据库配置(可在配置文件中使用)
|
||||
# MYSQL_HOST=localhost
|
||||
# MYSQL_PORT=3306
|
||||
|
||||
# Redis配置
|
||||
# REDIS_HOST=localhost
|
||||
# REDIS_PORT=6379
|
||||
|
||||
# Nacos配置
|
||||
# NACOS_HOST=localhost
|
||||
# NACOS_PORT=8848
|
||||
|
||||
# 日志级别
|
||||
# LOG_LEVEL=INFO
|
||||
18
scripts/restart-all.sh
Executable file
18
scripts/restart-all.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
# 一键重启所有服务
|
||||
|
||||
DEPLOY_HOME="/opt/fundplatform/deploy"
|
||||
|
||||
# 停止所有服务
|
||||
if [ -f "${DEPLOY_HOME}/stop-all.sh" ]; then
|
||||
${DEPLOY_HOME}/stop-all.sh
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Waiting 10 seconds..."
|
||||
sleep 10
|
||||
|
||||
# 启动所有服务
|
||||
if [ -f "${DEPLOY_HOME}/start-all.sh" ]; then
|
||||
${DEPLOY_HOME}/start-all.sh
|
||||
fi
|
||||
3
fund-sys/src/main/scripts/restart.sh → scripts/restart.sh
Normal file → Executable file
3
fund-sys/src/main/scripts/restart.sh → scripts/restart.sh
Normal file → Executable file
@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
# 服务重启脚本
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
||||
|
||||
${SCRIPT_DIR}/stop.sh
|
||||
sleep 3
|
||||
42
scripts/start-all.sh
Executable file
42
scripts/start-all.sh
Executable file
@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
# 一键启动所有服务
|
||||
|
||||
DEPLOY_HOME="/opt/fundplatform/deploy"
|
||||
|
||||
# 服务启动顺序
|
||||
SERVICES=(
|
||||
"fund-gateway"
|
||||
"fund-sys"
|
||||
"fund-cust"
|
||||
"fund-proj"
|
||||
"fund-req"
|
||||
"fund-exp"
|
||||
"fund-receipt"
|
||||
"fund-report"
|
||||
"fund-file"
|
||||
)
|
||||
|
||||
echo "=========================================="
|
||||
echo " Starting all services..."
|
||||
echo "=========================================="
|
||||
|
||||
for service in "${SERVICES[@]}"; do
|
||||
if [ -f "${DEPLOY_HOME}/${service}/bin/start.sh" ]; then
|
||||
echo ""
|
||||
echo "Starting ${service}..."
|
||||
${DEPLOY_HOME}/${service}/bin/start.sh
|
||||
sleep 5
|
||||
else
|
||||
echo "Warning: ${service}/bin/start.sh not found, skipping..."
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo " All services started"
|
||||
echo "=========================================="
|
||||
|
||||
# 显示状态
|
||||
if [ -f "${DEPLOY_HOME}/status.sh" ]; then
|
||||
${DEPLOY_HOME}/status.sh
|
||||
fi
|
||||
27
fund-sys/src/main/scripts/start.sh → scripts/start.sh
Normal file → Executable file
27
fund-sys/src/main/scripts/start.sh → scripts/start.sh
Normal file → Executable file
@ -1,13 +1,28 @@
|
||||
#!/bin/bash
|
||||
# 服务启动脚本
|
||||
APP_NAME="fund-sys"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
# 自动从目录名推断服务名称
|
||||
|
||||
# 获取脚本所在目录和服务名
|
||||
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
||||
APP_HOME=$(dirname "$SCRIPT_DIR")
|
||||
APP_NAME=$(basename "$APP_HOME")
|
||||
|
||||
# 日志目录
|
||||
LOG_HOME="/datacfs/applogs/${APP_NAME}"
|
||||
|
||||
# JAR文件路径
|
||||
JAR_FILE="${APP_HOME}/lib/${APP_NAME}.jar"
|
||||
|
||||
# PID文件路径
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# JVM参数
|
||||
JAVA_OPTS="-Xms256m -Xmx512m -XX:+UseG1GC -XX:MaxGCPauseMillis=200"
|
||||
# 加载环境变量配置(如果存在)
|
||||
if [ -f "${APP_HOME}/conf/env.properties" ]; then
|
||||
source "${APP_HOME}/conf/env.properties"
|
||||
fi
|
||||
|
||||
# JVM参数(可通过环境变量覆盖)
|
||||
JAVA_OPTS="${JAVA_OPTS:--Xms256m -Xmx512m -XX:+UseG1GC -XX:MaxGCPauseMillis=200}"
|
||||
|
||||
# 日志参数
|
||||
LOG_OPTS="-Dlogging.file.path=${LOG_HOME} -DAPP_NAME=${APP_NAME}"
|
||||
@ -29,6 +44,10 @@ mkdir -p ${LOG_HOME}
|
||||
|
||||
# 启动服务
|
||||
echo "Starting ${APP_NAME}..."
|
||||
echo " APP_HOME: ${APP_HOME}"
|
||||
echo " LOG_HOME: ${LOG_HOME}"
|
||||
echo " JAVA_OPTS: ${JAVA_OPTS}"
|
||||
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE $CONFIG_OPTS > /dev/null 2>&1 &
|
||||
|
||||
# 保存PID
|
||||
41
scripts/status-all.sh
Executable file
41
scripts/status-all.sh
Executable file
@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
# 查看所有服务状态
|
||||
|
||||
DEPLOY_HOME="/opt/fundplatform/deploy"
|
||||
|
||||
SERVICES=(
|
||||
"fund-gateway:8000"
|
||||
"fund-sys:8100"
|
||||
"fund-cust:8200"
|
||||
"fund-proj:8300"
|
||||
"fund-req:8400"
|
||||
"fund-exp:8500"
|
||||
"fund-receipt:8600"
|
||||
"fund-report:8700"
|
||||
"fund-file:8800"
|
||||
)
|
||||
|
||||
echo "=========================================="
|
||||
echo " Service Status"
|
||||
echo "=========================================="
|
||||
printf "%-20s %-10s %-10s %s\n" "Service" "Port" "Status" "PID"
|
||||
echo "------------------------------------------"
|
||||
|
||||
for item in "${SERVICES[@]}"; do
|
||||
service="${item%%:*}"
|
||||
port="${item##*:}"
|
||||
pid_file="${DEPLOY_HOME}/${service}/${service}.pid"
|
||||
|
||||
if [ -f "$pid_file" ]; then
|
||||
PID=$(cat $pid_file)
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
printf "%-20s %-10s \033[32m%-10s\033[0m %s\n" "$service" "$port" "RUNNING" "$PID"
|
||||
else
|
||||
printf "%-20s %-10s \033[31m%-10s\033[0m %s\n" "$service" "$port" "STOPPED" "-"
|
||||
fi
|
||||
else
|
||||
printf "%-20s %-10s \033[31m%-10s\033[0m %s\n" "$service" "$port" "STOPPED" "-"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "=========================================="
|
||||
12
fund-sys/src/main/scripts/status.sh → scripts/status.sh
Normal file → Executable file
12
fund-sys/src/main/scripts/status.sh → scripts/status.sh
Normal file → Executable file
@ -1,7 +1,13 @@
|
||||
#!/bin/bash
|
||||
# 查看服务状态
|
||||
APP_NAME="fund-sys"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
# 自动从目录名推断服务名称
|
||||
|
||||
# 获取脚本所在目录和服务名
|
||||
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
||||
APP_HOME=$(dirname "$SCRIPT_DIR")
|
||||
APP_NAME=$(basename "$APP_HOME")
|
||||
|
||||
# PID文件路径
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
echo "=========================================="
|
||||
@ -13,6 +19,8 @@ if [ -f "$PID_FILE" ]; then
|
||||
if ps -p $PID > /dev/null 2>&1; then
|
||||
echo -e "Status: \033[32mRUNNING\033[0m"
|
||||
echo "PID: ${PID}"
|
||||
echo "Home: ${APP_HOME}"
|
||||
echo ""
|
||||
# 显示进程信息
|
||||
ps -p $PID -o pid,ppid,%cpu,%mem,etime,cmd --no-headers 2>/dev/null
|
||||
else
|
||||
37
scripts/stop-all.sh
Executable file
37
scripts/stop-all.sh
Executable file
@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
# 一键停止所有服务
|
||||
|
||||
DEPLOY_HOME="/opt/fundplatform/deploy"
|
||||
|
||||
# 服务停止顺序(反向停止)
|
||||
SERVICES=(
|
||||
"fund-file"
|
||||
"fund-report"
|
||||
"fund-receipt"
|
||||
"fund-exp"
|
||||
"fund-req"
|
||||
"fund-proj"
|
||||
"fund-cust"
|
||||
"fund-sys"
|
||||
"fund-gateway"
|
||||
)
|
||||
|
||||
echo "=========================================="
|
||||
echo " Stopping all services..."
|
||||
echo "=========================================="
|
||||
|
||||
for service in "${SERVICES[@]}"; do
|
||||
if [ -f "${DEPLOY_HOME}/${service}/bin/stop.sh" ]; then
|
||||
echo ""
|
||||
echo "Stopping ${service}..."
|
||||
${DEPLOY_HOME}/${service}/bin/stop.sh
|
||||
sleep 2
|
||||
else
|
||||
echo "Warning: ${service}/bin/stop.sh not found, skipping..."
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo " All services stopped"
|
||||
echo "=========================================="
|
||||
10
fund-sys/src/main/scripts/stop.sh → scripts/stop.sh
Normal file → Executable file
10
fund-sys/src/main/scripts/stop.sh → scripts/stop.sh
Normal file → Executable file
@ -1,7 +1,13 @@
|
||||
#!/bin/bash
|
||||
# 服务停止脚本
|
||||
APP_NAME="fund-sys"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
# 自动从目录名推断服务名称
|
||||
|
||||
# 获取脚本所在目录和服务名
|
||||
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
||||
APP_HOME=$(dirname "$SCRIPT_DIR")
|
||||
APP_NAME=$(basename "$APP_HOME")
|
||||
|
||||
# PID文件路径
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# 检查是否运行
|
||||
Loading…
x
Reference in New Issue
Block a user