feat: 使用Maven Assembly实现标准化打包
主要更新: - 每个服务打包为独立tar.gz,包含bin/lib/conf目录 - bin目录:启动/停止/重启/状态脚本 - lib目录:服务JAR包及所有依赖 - conf目录:配置文件(application.yml等) 新增文件: - 各模块src/main/assembly/assembly.xml配置 - 各模块src/main/scripts启动脚本 - server-deploy/scripts一键管理脚本 - server-deploy/assembly/assembly.xml模板 更新文档: - 单机部署文档v2.0,说明assembly打包方式
This commit is contained in:
parent
734dafe975
commit
7a3fcb3ed7
@ -1,2 +1,2 @@
|
||||
#Fri Feb 20 18:45:42 CST 2026
|
||||
central|https\://repo1.maven.org/maven2|null=1771584342966
|
||||
#Sun Feb 22 13:58:28 CST 2026
|
||||
central|https\://repo1.maven.org/maven2|null=1771739908393
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
#Fri Feb 20 18:45:42 CST 2026
|
||||
central|https\://repo1.maven.org/maven2|null=1771584342984
|
||||
#Sun Feb 22 13:58:28 CST 2026
|
||||
central|https\://repo1.maven.org/maven2|null=1771739908396
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
#Fri Feb 20 18:45:43 CST 2026
|
||||
central|https\://repo1.maven.org/maven2|null=1771584343003
|
||||
#Sun Feb 22 13:58:28 CST 2026
|
||||
central|https\://repo1.maven.org/maven2|null=1771739908400
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
#Fri Feb 20 18:45:43 CST 2026
|
||||
central|https\://repo1.maven.org/maven2|null=1771584343001
|
||||
#Sun Feb 22 13:58:28 CST 2026
|
||||
central|https\://repo1.maven.org/maven2|null=1771739908400
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
#Fri Feb 20 18:45:42 CST 2026
|
||||
central|https\://repo1.maven.org/maven2|null=1771584342991
|
||||
#Sun Feb 22 13:58:28 CST 2026
|
||||
central|https\://repo1.maven.org/maven2|null=1771739908398
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
#Fri Feb 20 18:45:42 CST 2026
|
||||
central|https\://repo1.maven.org/maven2|null=1771584342979
|
||||
#Sun Feb 22 13:58:28 CST 2026
|
||||
central|https\://repo1.maven.org/maven2|null=1771739908394
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
#Fri Feb 20 18:45:43 CST 2026
|
||||
central|https\://repo1.maven.org/maven2|null=1771584343012
|
||||
#Sun Feb 22 13:58:28 CST 2026
|
||||
central|https\://repo1.maven.org/maven2|null=1771739908401
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
#Fri Feb 20 18:45:42 CST 2026
|
||||
central|https\://repo1.maven.org/maven2|null=1771584342989
|
||||
#Sun Feb 22 13:58:28 CST 2026
|
||||
central|https\://repo1.maven.org/maven2|null=1771739908397
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
#Fri Feb 20 18:45:42 CST 2026
|
||||
central|https\://repo1.maven.org/maven2|null=1771584342997
|
||||
#Sun Feb 22 13:58:28 CST 2026
|
||||
central|https\://repo1.maven.org/maven2|null=1771739908398
|
||||
|
||||
390
doc/单机部署文档.md
390
doc/单机部署文档.md
@ -1,7 +1,7 @@
|
||||
# 资金服务平台单机部署文档
|
||||
|
||||
> 版本: v1.0
|
||||
> 更新日期: 2026-02-20
|
||||
> 版本: v2.0
|
||||
> 更新日期: 2026-02-22
|
||||
> 作者: zhangjf
|
||||
|
||||
---
|
||||
@ -70,17 +70,19 @@
|
||||
/opt/fundplatform/ # 应用根目录
|
||||
├── deploy/ # 部署目录
|
||||
│ ├── fund-gateway/ # Gateway服务
|
||||
│ │ ├── fund-gateway.jar # 服务JAR包
|
||||
│ │ ├── application.yml # 服务配置文件
|
||||
│ │ ├── start.sh # 启动脚本
|
||||
│ │ ├── stop.sh # 停止脚本
|
||||
│ │ └── restart.sh # 重启脚本
|
||||
│ │ ├── bin/ # 脚本目录
|
||||
│ │ │ ├── start.sh # 启动脚本
|
||||
│ │ │ ├── stop.sh # 停止脚本
|
||||
│ │ │ ├── restart.sh # 重启脚本
|
||||
│ │ │ └── status.sh # 状态查看脚本
|
||||
│ │ ├── lib/ # 依赖JAR目录
|
||||
│ │ │ └── fund-gateway.jar # 服务JAR包
|
||||
│ │ └── conf/ # 配置文件目录
|
||||
│ │ └── application.yml # 服务配置文件
|
||||
│ ├── fund-sys/ # 系统服务
|
||||
│ │ ├── fund-sys.jar
|
||||
│ │ ├── application.yml
|
||||
│ │ ├── start.sh
|
||||
│ │ ├── stop.sh
|
||||
│ │ └── restart.sh
|
||||
│ │ ├── bin/
|
||||
│ │ ├── lib/
|
||||
│ │ └── conf/
|
||||
│ ├── fund-cust/ # 客户服务
|
||||
│ ├── fund-proj/ # 项目服务
|
||||
│ ├── fund-req/ # 需求服务
|
||||
@ -92,6 +94,18 @@
|
||||
│ ├── stop-all.sh # 一键停止所有服务
|
||||
│ ├── restart-all.sh # 一键重启所有服务
|
||||
│ └── status.sh # 查看所有服务状态
|
||||
├── packages/ # 发布包目录
|
||||
│ ├── fund-gateway.tar.gz # Gateway服务发布包
|
||||
│ ├── fund-sys.tar.gz # 系统服务发布包
|
||||
│ ├── fund-cust.tar.gz # 客户服务发布包
|
||||
│ ├── fund-proj.tar.gz # 项目服务发布包
|
||||
│ ├── fund-req.tar.gz # 需求服务发布包
|
||||
│ ├── fund-exp.tar.gz # 支出服务发布包
|
||||
│ ├── fund-receipt.tar.gz # 收款服务发布包
|
||||
│ ├── fund-report.tar.gz # 报表服务发布包
|
||||
│ ├── fund-file.tar.gz # 文件服务发布包
|
||||
│ ├── fund-admin.zip # 管理后台前端发布包
|
||||
│ └── fund-mobile.zip # 移动端H5发布包
|
||||
├── sql/ # 数据库脚本
|
||||
│ ├── fund_platform_schema.sql # 表结构
|
||||
│ └── fund_platform_init.sql # 初始化数据
|
||||
@ -347,31 +361,109 @@ mkdir -p /datacfs/applogs/fund-file
|
||||
|
||||
### 4.2 编译打包
|
||||
|
||||
项目使用 **Maven Assembly Plugin** 实现标准化打包,每个服务打包为一个独立的 `tar.gz` 文件。
|
||||
|
||||
#### 4.2.1 后端服务打包
|
||||
|
||||
```bash
|
||||
# 在开发机上编译打包
|
||||
cd /path/to/fundplatform
|
||||
mvn clean package -DskipTests
|
||||
|
||||
# 打包结果
|
||||
# fund-gateway/target/fund-gateway-0.0.1-SNAPSHOT.jar
|
||||
# fund-sys/target/fund-sys-0.0.1-SNAPSHOT.jar
|
||||
# ...
|
||||
# 打包结果(位于各模块的target目录)
|
||||
# fund-gateway/target/fund-gateway.tar.gz
|
||||
# fund-sys/target/fund-sys.tar.gz
|
||||
# fund-cust/target/fund-cust.tar.gz
|
||||
# fund-proj/target/fund-proj.tar.gz
|
||||
# fund-req/target/fund-req.tar.gz
|
||||
# fund-exp/target/fund-exp.tar.gz
|
||||
# fund-receipt/target/fund-receipt.tar.gz
|
||||
# fund-report/target/fund-report.tar.gz
|
||||
# fund-file/target/fund-file.tar.gz
|
||||
```
|
||||
|
||||
#### 4.2.2 打包结构说明
|
||||
|
||||
每个服务的 `tar.gz` 包解压后包含以下目录结构:
|
||||
|
||||
```
|
||||
fund-sys/
|
||||
├── bin/ # 脚本目录
|
||||
│ ├── start.sh # 启动脚本
|
||||
│ ├── stop.sh # 停止脚本
|
||||
│ ├── restart.sh # 重启脚本
|
||||
│ └── status.sh # 状态查看脚本
|
||||
├── lib/ # 依赖JAR目录
|
||||
│ └── fund-sys.jar # 服务JAR包(包含所有依赖)
|
||||
└── conf/ # 配置文件目录
|
||||
├── application.yml # 主配置文件
|
||||
├── application-*.yml # 环境配置文件
|
||||
└── logback-spring.xml # 日志配置文件
|
||||
```
|
||||
|
||||
#### 4.2.3 前端打包
|
||||
|
||||
```bash
|
||||
# 管理后台打包
|
||||
cd fund-admin
|
||||
npm install
|
||||
npm run build
|
||||
# 生成 dist 目录,打包为 fund-admin.zip
|
||||
zip -r fund-admin.zip dist/
|
||||
|
||||
# 移动端H5打包
|
||||
cd fund-mobile
|
||||
npm install
|
||||
npm run build
|
||||
# 生成 dist 目录,打包为 fund-mobile.zip
|
||||
zip -r fund-mobile.zip dist/
|
||||
```
|
||||
|
||||
### 4.3 上传部署文件
|
||||
|
||||
```bash
|
||||
# 上传JAR包和配置文件到服务器
|
||||
scp fund-gateway/target/fund-gateway-0.0.1-SNAPSHOT.jar user@server:/opt/fundplatform/deploy/fund-gateway/fund-gateway.jar
|
||||
scp fund-gateway/src/main/resources/application.yml user@server:/opt/fundplatform/deploy/fund-gateway/
|
||||
# 创建发布包目录
|
||||
mkdir -p /opt/fundplatform/packages
|
||||
|
||||
scp fund-sys/target/fund-sys-0.0.1-SNAPSHOT.jar user@server:/opt/fundplatform/deploy/fund-sys/fund-sys.jar
|
||||
scp fund-sys/src/main/resources/application.yml user@server:/opt/fundplatform/deploy/fund-sys/
|
||||
# 上传后端服务发布包
|
||||
scp fund-gateway/target/fund-gateway.tar.gz user@server:/opt/fundplatform/packages/
|
||||
scp fund-sys/target/fund-sys.tar.gz user@server:/opt/fundplatform/packages/
|
||||
scp fund-cust/target/fund-cust.tar.gz user@server:/opt/fundplatform/packages/
|
||||
scp fund-proj/target/fund-proj.tar.gz user@server:/opt/fundplatform/packages/
|
||||
scp fund-req/target/fund-req.tar.gz user@server:/opt/fundplatform/packages/
|
||||
scp fund-exp/target/fund-exp.tar.gz user@server:/opt/fundplatform/packages/
|
||||
scp fund-receipt/target/fund-receipt.tar.gz user@server:/opt/fundplatform/packages/
|
||||
scp fund-report/target/fund-report.tar.gz user@server:/opt/fundplatform/packages/
|
||||
scp fund-file/target/fund-file.tar.gz user@server:/opt/fundplatform/packages/
|
||||
|
||||
# ... 其他服务类似
|
||||
# 上传前端发布包
|
||||
scp fund-admin.zip user@server:/opt/fundplatform/packages/
|
||||
scp fund-mobile.zip user@server:/opt/fundplatform/packages/
|
||||
```
|
||||
|
||||
### 4.4 配置文件修改
|
||||
### 4.4 解压部署
|
||||
|
||||
```bash
|
||||
# 解压后端服务到deploy目录
|
||||
cd /opt/fundplatform/packages
|
||||
|
||||
tar -xzf fund-gateway.tar.gz -C /opt/fundplatform/deploy/
|
||||
tar -xzf fund-sys.tar.gz -C /opt/fundplatform/deploy/
|
||||
tar -xzf fund-cust.tar.gz -C /opt/fundplatform/deploy/
|
||||
tar -xzf fund-proj.tar.gz -C /opt/fundplatform/deploy/
|
||||
tar -xzf fund-req.tar.gz -C /opt/fundplatform/deploy/
|
||||
tar -xzf fund-exp.tar.gz -C /opt/fundplatform/deploy/
|
||||
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/
|
||||
```
|
||||
|
||||
### 4.5 配置文件修改
|
||||
|
||||
各服务配置文件需要根据实际环境修改以下配置:
|
||||
|
||||
@ -398,253 +490,49 @@ spring:
|
||||
namespace: fund-platform
|
||||
```
|
||||
|
||||
### 4.5 部署脚本
|
||||
### 4.6 服务管理脚本
|
||||
|
||||
每个服务目录下包含以下脚本:
|
||||
每个服务的 `bin` 目录下包含以下脚本:
|
||||
|
||||
#### start.sh - 启动脚本
|
||||
| 脚本 | 说明 |
|
||||
|------|------|
|
||||
| start.sh | 启动服务 |
|
||||
| stop.sh | 停止服务 |
|
||||
| restart.sh | 重启服务 |
|
||||
| status.sh | 查看服务状态 |
|
||||
|
||||
#### 4.6.1 单服务管理
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# 服务启动脚本
|
||||
# 启动单个服务
|
||||
/opt/fundplatform/deploy/fund-sys/bin/start.sh
|
||||
|
||||
APP_NAME="fund-gateway"
|
||||
APP_HOME="/opt/fundplatform/deploy/${APP_NAME}"
|
||||
LOG_HOME="/datacfs/applogs/${APP_NAME}"
|
||||
JAR_FILE="${APP_HOME}/${APP_NAME}.jar"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
# 停止单个服务
|
||||
/opt/fundplatform/deploy/fund-sys/bin/stop.sh
|
||||
|
||||
# JVM参数
|
||||
JAVA_OPTS="-Xms256m -Xmx512m -XX:+UseG1GC"
|
||||
# 重启单个服务
|
||||
/opt/fundplatform/deploy/fund-sys/bin/restart.sh
|
||||
|
||||
# 日志参数
|
||||
LOG_OPTS="-Dlogging.file.path=${LOG_HOME} -DAPP_NAME=${APP_NAME}"
|
||||
|
||||
# 检查是否已运行
|
||||
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
|
||||
|
||||
# 启动服务
|
||||
echo "Starting ${APP_NAME}..."
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE \
|
||||
--spring.config.location=${APP_HOME}/application.yml \
|
||||
> /dev/null 2>&1 &
|
||||
|
||||
# 保存PID
|
||||
echo $! > $PID_FILE
|
||||
echo "${APP_NAME} started (PID: $(cat $PID_FILE))"
|
||||
# 查看服务状态
|
||||
/opt/fundplatform/deploy/fund-sys/bin/status.sh
|
||||
```
|
||||
|
||||
#### stop.sh - 停止脚本
|
||||
#### 4.6.2 一键管理所有服务
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# 服务停止脚本
|
||||
|
||||
APP_NAME="fund-gateway"
|
||||
APP_HOME="/opt/fundplatform/deploy/${APP_NAME}"
|
||||
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"
|
||||
```
|
||||
|
||||
#### restart.sh - 重启脚本
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# 服务重启脚本
|
||||
|
||||
APP_NAME="fund-gateway"
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
${SCRIPT_DIR}/stop.sh
|
||||
sleep 3
|
||||
${SCRIPT_DIR}/start.sh
|
||||
```
|
||||
|
||||
### 4.6 一键管理脚本
|
||||
|
||||
#### start-all.sh - 一键启动所有服务
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# 一键启动所有服务
|
||||
/opt/fundplatform/deploy/start-all.sh
|
||||
|
||||
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}/start.sh" ]; then
|
||||
echo ""
|
||||
echo "Starting ${service}..."
|
||||
${DEPLOY_HOME}/${service}/start.sh
|
||||
sleep 5
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo " All services started"
|
||||
echo "=========================================="
|
||||
${DEPLOY_HOME}/status.sh
|
||||
```
|
||||
|
||||
#### stop-all.sh - 一键停止所有服务
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# 一键停止所有服务
|
||||
/opt/fundplatform/deploy/stop-all.sh
|
||||
|
||||
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}/stop.sh" ]; then
|
||||
echo ""
|
||||
echo "Stopping ${service}..."
|
||||
${DEPLOY_HOME}/${service}/stop.sh
|
||||
sleep 2
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo " All services stopped"
|
||||
echo "=========================================="
|
||||
```
|
||||
|
||||
#### restart-all.sh - 一键重启所有服务
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# 一键重启所有服务
|
||||
/opt/fundplatform/deploy/restart-all.sh
|
||||
|
||||
DEPLOY_HOME="/opt/fundplatform/deploy"
|
||||
|
||||
${DEPLOY_HOME}/stop-all.sh
|
||||
echo ""
|
||||
echo "Waiting 10 seconds..."
|
||||
sleep 10
|
||||
${DEPLOY_HOME}/start-all.sh
|
||||
```
|
||||
|
||||
#### status.sh - 查看所有服务状态
|
||||
|
||||
```bash
|
||||
#!/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 "=========================================="
|
||||
/opt/fundplatform/deploy/status.sh
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 五、部署操作指南
|
||||
|
||||
### 5.1 首次部署
|
||||
|
||||
@ -73,6 +73,31 @@
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Maven Assembly Plugin - 打包为tar.gz -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
43
fund-cust/src/main/assembly/assembly.xml
Normal file
43
fund-cust/src/main/assembly/assembly.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<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,6 +1,5 @@
|
||||
#!/bin/bash
|
||||
# fund-sys 服务重启脚本
|
||||
|
||||
#\!/bin/bash
|
||||
# 服务重启脚本
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
${SCRIPT_DIR}/stop.sh
|
||||
@ -1,10 +1,9 @@
|
||||
#!/bin/bash
|
||||
# fund-cust 服务启动脚本
|
||||
|
||||
#\!/bin/bash
|
||||
# 服务启动脚本
|
||||
APP_NAME="fund-cust"
|
||||
APP_HOME="/opt/fundplatform/deploy/${APP_NAME}"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
LOG_HOME="/datacfs/applogs/${APP_NAME}"
|
||||
JAR_FILE="${APP_HOME}/${APP_NAME}.jar"
|
||||
JAR_FILE="${APP_HOME}/lib/${APP_NAME}.jar"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# JVM参数
|
||||
@ -13,6 +12,9 @@ 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)
|
||||
@ -27,10 +29,8 @@ mkdir -p ${LOG_HOME}
|
||||
|
||||
# 启动服务
|
||||
echo "Starting ${APP_NAME}..."
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE \
|
||||
--spring.config.location=${APP_HOME}/application.yml \
|
||||
> /dev/null 2>&1 &
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE $CONFIG_OPTS > /dev/null 2>&1 &
|
||||
|
||||
# 保存PID
|
||||
echo $! > $PID_FILE
|
||||
echo $\! > $PID_FILE
|
||||
echo "${APP_NAME} started (PID: $(cat $PID_FILE))"
|
||||
25
fund-cust/src/main/scripts/status.sh
Executable file
25
fund-cust/src/main/scripts/status.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#\!/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,18 +1,17 @@
|
||||
#!/bin/bash
|
||||
# fund-cust 服务停止脚本
|
||||
|
||||
#\!/bin/bash
|
||||
# 服务停止脚本
|
||||
APP_NAME="fund-cust"
|
||||
APP_HOME="/opt/fundplatform/deploy/${APP_NAME}"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# 检查是否运行
|
||||
if [ ! -f "$PID_FILE" ]; then
|
||||
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
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
echo "${APP_NAME} is not running"
|
||||
rm -f $PID_FILE
|
||||
exit 0
|
||||
@ -24,7 +23,7 @@ kill $PID
|
||||
|
||||
# 等待停止
|
||||
for i in {1..30}; do
|
||||
if ! ps -p $PID > /dev/null 2>&1; then
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
@ -65,6 +65,31 @@
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Maven Assembly Plugin - 打包为tar.gz -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
43
fund-exp/src/main/assembly/assembly.xml
Normal file
43
fund-exp/src/main/assembly/assembly.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<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,6 +1,5 @@
|
||||
#!/bin/bash
|
||||
# fund-exp 服务重启脚本
|
||||
|
||||
#\!/bin/bash
|
||||
# 服务重启脚本
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
${SCRIPT_DIR}/stop.sh
|
||||
@ -1,10 +1,9 @@
|
||||
#!/bin/bash
|
||||
# fund-exp 服务启动脚本
|
||||
|
||||
#\!/bin/bash
|
||||
# 服务启动脚本
|
||||
APP_NAME="fund-exp"
|
||||
APP_HOME="/opt/fundplatform/deploy/${APP_NAME}"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
LOG_HOME="/datacfs/applogs/${APP_NAME}"
|
||||
JAR_FILE="${APP_HOME}/${APP_NAME}.jar"
|
||||
JAR_FILE="${APP_HOME}/lib/${APP_NAME}.jar"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# JVM参数
|
||||
@ -13,6 +12,9 @@ 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)
|
||||
@ -27,10 +29,8 @@ mkdir -p ${LOG_HOME}
|
||||
|
||||
# 启动服务
|
||||
echo "Starting ${APP_NAME}..."
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE \
|
||||
--spring.config.location=${APP_HOME}/application.yml \
|
||||
> /dev/null 2>&1 &
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE $CONFIG_OPTS > /dev/null 2>&1 &
|
||||
|
||||
# 保存PID
|
||||
echo $! > $PID_FILE
|
||||
echo $\! > $PID_FILE
|
||||
echo "${APP_NAME} started (PID: $(cat $PID_FILE))"
|
||||
25
fund-exp/src/main/scripts/status.sh
Executable file
25
fund-exp/src/main/scripts/status.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#\!/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,18 +1,17 @@
|
||||
#!/bin/bash
|
||||
# fund-exp 服务停止脚本
|
||||
|
||||
#\!/bin/bash
|
||||
# 服务停止脚本
|
||||
APP_NAME="fund-exp"
|
||||
APP_HOME="/opt/fundplatform/deploy/${APP_NAME}"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# 检查是否运行
|
||||
if [ ! -f "$PID_FILE" ]; then
|
||||
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
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
echo "${APP_NAME} is not running"
|
||||
rm -f $PID_FILE
|
||||
exit 0
|
||||
@ -24,7 +23,7 @@ kill $PID
|
||||
|
||||
# 等待停止
|
||||
for i in {1..30}; do
|
||||
if ! ps -p $PID > /dev/null 2>&1; then
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
@ -71,6 +71,31 @@
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Maven Assembly Plugin - 打包为tar.gz -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
43
fund-file/src/main/assembly/assembly.xml
Normal file
43
fund-file/src/main/assembly/assembly.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<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,6 +1,5 @@
|
||||
#!/bin/bash
|
||||
# fund-proj 服务重启脚本
|
||||
|
||||
#\!/bin/bash
|
||||
# 服务重启脚本
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
${SCRIPT_DIR}/stop.sh
|
||||
@ -1,10 +1,9 @@
|
||||
#!/bin/bash
|
||||
# fund-file 服务启动脚本
|
||||
|
||||
#\!/bin/bash
|
||||
# 服务启动脚本
|
||||
APP_NAME="fund-file"
|
||||
APP_HOME="/opt/fundplatform/deploy/${APP_NAME}"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
LOG_HOME="/datacfs/applogs/${APP_NAME}"
|
||||
JAR_FILE="${APP_HOME}/${APP_NAME}.jar"
|
||||
JAR_FILE="${APP_HOME}/lib/${APP_NAME}.jar"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# JVM参数
|
||||
@ -13,6 +12,9 @@ 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)
|
||||
@ -27,10 +29,8 @@ mkdir -p ${LOG_HOME}
|
||||
|
||||
# 启动服务
|
||||
echo "Starting ${APP_NAME}..."
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE \
|
||||
--spring.config.location=${APP_HOME}/application.yml \
|
||||
> /dev/null 2>&1 &
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE $CONFIG_OPTS > /dev/null 2>&1 &
|
||||
|
||||
# 保存PID
|
||||
echo $! > $PID_FILE
|
||||
echo $\! > $PID_FILE
|
||||
echo "${APP_NAME} started (PID: $(cat $PID_FILE))"
|
||||
25
fund-file/src/main/scripts/status.sh
Executable file
25
fund-file/src/main/scripts/status.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#\!/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,18 +1,17 @@
|
||||
#!/bin/bash
|
||||
# fund-file 服务停止脚本
|
||||
|
||||
#\!/bin/bash
|
||||
# 服务停止脚本
|
||||
APP_NAME="fund-file"
|
||||
APP_HOME="/opt/fundplatform/deploy/${APP_NAME}"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# 检查是否运行
|
||||
if [ ! -f "$PID_FILE" ]; then
|
||||
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
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
echo "${APP_NAME} is not running"
|
||||
rm -f $PID_FILE
|
||||
exit 0
|
||||
@ -24,7 +23,7 @@ kill $PID
|
||||
|
||||
# 等待停止
|
||||
for i in {1..30}; do
|
||||
if ! ps -p $PID > /dev/null 2>&1; then
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
@ -76,6 +76,31 @@
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Maven Assembly Plugin - 打包为tar.gz -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
43
fund-gateway/src/main/assembly/assembly.xml
Normal file
43
fund-gateway/src/main/assembly/assembly.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<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>
|
||||
7
fund-gateway/src/main/scripts/restart.sh
Executable file
7
fund-gateway/src/main/scripts/restart.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#\!/bin/bash
|
||||
# 服务重启脚本
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
${SCRIPT_DIR}/stop.sh
|
||||
sleep 3
|
||||
${SCRIPT_DIR}/start.sh
|
||||
@ -1,10 +1,9 @@
|
||||
#!/bin/bash
|
||||
# fund-gateway 服务启动脚本
|
||||
|
||||
#\!/bin/bash
|
||||
# 服务启动脚本
|
||||
APP_NAME="fund-gateway"
|
||||
APP_HOME="/opt/fundplatform/deploy/${APP_NAME}"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
LOG_HOME="/datacfs/applogs/${APP_NAME}"
|
||||
JAR_FILE="${APP_HOME}/${APP_NAME}.jar"
|
||||
JAR_FILE="${APP_HOME}/lib/${APP_NAME}.jar"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# JVM参数
|
||||
@ -13,6 +12,9 @@ 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)
|
||||
@ -27,10 +29,8 @@ mkdir -p ${LOG_HOME}
|
||||
|
||||
# 启动服务
|
||||
echo "Starting ${APP_NAME}..."
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE \
|
||||
--spring.config.location=${APP_HOME}/application.yml \
|
||||
> /dev/null 2>&1 &
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE $CONFIG_OPTS > /dev/null 2>&1 &
|
||||
|
||||
# 保存PID
|
||||
echo $! > $PID_FILE
|
||||
echo $\! > $PID_FILE
|
||||
echo "${APP_NAME} started (PID: $(cat $PID_FILE))"
|
||||
25
fund-gateway/src/main/scripts/status.sh
Executable file
25
fund-gateway/src/main/scripts/status.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#\!/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 "=========================================="
|
||||
39
fund-gateway/src/main/scripts/stop.sh
Executable file
39
fund-gateway/src/main/scripts/stop.sh
Executable file
@ -0,0 +1,39 @@
|
||||
#\!/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"
|
||||
@ -65,6 +65,31 @@
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Maven Assembly Plugin - 打包为tar.gz -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
43
fund-proj/src/main/assembly/assembly.xml
Normal file
43
fund-proj/src/main/assembly/assembly.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<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>
|
||||
7
fund-proj/src/main/scripts/restart.sh
Executable file
7
fund-proj/src/main/scripts/restart.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#\!/bin/bash
|
||||
# 服务重启脚本
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
${SCRIPT_DIR}/stop.sh
|
||||
sleep 3
|
||||
${SCRIPT_DIR}/start.sh
|
||||
@ -1,10 +1,9 @@
|
||||
#!/bin/bash
|
||||
# fund-proj 服务启动脚本
|
||||
|
||||
#\!/bin/bash
|
||||
# 服务启动脚本
|
||||
APP_NAME="fund-proj"
|
||||
APP_HOME="/opt/fundplatform/deploy/${APP_NAME}"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
LOG_HOME="/datacfs/applogs/${APP_NAME}"
|
||||
JAR_FILE="${APP_HOME}/${APP_NAME}.jar"
|
||||
JAR_FILE="${APP_HOME}/lib/${APP_NAME}.jar"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# JVM参数
|
||||
@ -13,6 +12,9 @@ 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)
|
||||
@ -27,10 +29,8 @@ mkdir -p ${LOG_HOME}
|
||||
|
||||
# 启动服务
|
||||
echo "Starting ${APP_NAME}..."
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE \
|
||||
--spring.config.location=${APP_HOME}/application.yml \
|
||||
> /dev/null 2>&1 &
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE $CONFIG_OPTS > /dev/null 2>&1 &
|
||||
|
||||
# 保存PID
|
||||
echo $! > $PID_FILE
|
||||
echo $\! > $PID_FILE
|
||||
echo "${APP_NAME} started (PID: $(cat $PID_FILE))"
|
||||
25
fund-proj/src/main/scripts/status.sh
Executable file
25
fund-proj/src/main/scripts/status.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#\!/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,18 +1,17 @@
|
||||
#!/bin/bash
|
||||
# fund-proj 服务停止脚本
|
||||
|
||||
#\!/bin/bash
|
||||
# 服务停止脚本
|
||||
APP_NAME="fund-proj"
|
||||
APP_HOME="/opt/fundplatform/deploy/${APP_NAME}"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# 检查是否运行
|
||||
if [ ! -f "$PID_FILE" ]; then
|
||||
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
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
echo "${APP_NAME} is not running"
|
||||
rm -f $PID_FILE
|
||||
exit 0
|
||||
@ -24,7 +23,7 @@ kill $PID
|
||||
|
||||
# 等待停止
|
||||
for i in {1..30}; do
|
||||
if ! ps -p $PID > /dev/null 2>&1; then
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
@ -65,6 +65,31 @@
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Maven Assembly Plugin - 打包为tar.gz -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
43
fund-receipt/src/main/assembly/assembly.xml
Normal file
43
fund-receipt/src/main/assembly/assembly.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<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>
|
||||
7
fund-receipt/src/main/scripts/restart.sh
Executable file
7
fund-receipt/src/main/scripts/restart.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#\!/bin/bash
|
||||
# 服务重启脚本
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
${SCRIPT_DIR}/stop.sh
|
||||
sleep 3
|
||||
${SCRIPT_DIR}/start.sh
|
||||
@ -1,10 +1,9 @@
|
||||
#!/bin/bash
|
||||
# fund-receipt 服务启动脚本
|
||||
|
||||
#\!/bin/bash
|
||||
# 服务启动脚本
|
||||
APP_NAME="fund-receipt"
|
||||
APP_HOME="/opt/fundplatform/deploy/${APP_NAME}"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
LOG_HOME="/datacfs/applogs/${APP_NAME}"
|
||||
JAR_FILE="${APP_HOME}/${APP_NAME}.jar"
|
||||
JAR_FILE="${APP_HOME}/lib/${APP_NAME}.jar"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# JVM参数
|
||||
@ -13,6 +12,9 @@ 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)
|
||||
@ -27,10 +29,8 @@ mkdir -p ${LOG_HOME}
|
||||
|
||||
# 启动服务
|
||||
echo "Starting ${APP_NAME}..."
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE \
|
||||
--spring.config.location=${APP_HOME}/application.yml \
|
||||
> /dev/null 2>&1 &
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE $CONFIG_OPTS > /dev/null 2>&1 &
|
||||
|
||||
# 保存PID
|
||||
echo $! > $PID_FILE
|
||||
echo $\! > $PID_FILE
|
||||
echo "${APP_NAME} started (PID: $(cat $PID_FILE))"
|
||||
25
fund-receipt/src/main/scripts/status.sh
Executable file
25
fund-receipt/src/main/scripts/status.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#\!/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,18 +1,17 @@
|
||||
#!/bin/bash
|
||||
# fund-receipt 服务停止脚本
|
||||
|
||||
#\!/bin/bash
|
||||
# 服务停止脚本
|
||||
APP_NAME="fund-receipt"
|
||||
APP_HOME="/opt/fundplatform/deploy/${APP_NAME}"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# 检查是否运行
|
||||
if [ ! -f "$PID_FILE" ]; then
|
||||
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
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
echo "${APP_NAME} is not running"
|
||||
rm -f $PID_FILE
|
||||
exit 0
|
||||
@ -24,7 +23,7 @@ kill $PID
|
||||
|
||||
# 等待停止
|
||||
for i in {1..30}; do
|
||||
if ! ps -p $PID > /dev/null 2>&1; then
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
@ -70,6 +70,31 @@
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Maven Assembly Plugin - 打包为tar.gz -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
43
fund-report/src/main/assembly/assembly.xml
Normal file
43
fund-report/src/main/assembly/assembly.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<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>
|
||||
7
fund-report/src/main/scripts/restart.sh
Executable file
7
fund-report/src/main/scripts/restart.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#\!/bin/bash
|
||||
# 服务重启脚本
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
${SCRIPT_DIR}/stop.sh
|
||||
sleep 3
|
||||
${SCRIPT_DIR}/start.sh
|
||||
@ -1,10 +1,9 @@
|
||||
#!/bin/bash
|
||||
# fund-report 服务启动脚本
|
||||
|
||||
#\!/bin/bash
|
||||
# 服务启动脚本
|
||||
APP_NAME="fund-report"
|
||||
APP_HOME="/opt/fundplatform/deploy/${APP_NAME}"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
LOG_HOME="/datacfs/applogs/${APP_NAME}"
|
||||
JAR_FILE="${APP_HOME}/${APP_NAME}.jar"
|
||||
JAR_FILE="${APP_HOME}/lib/${APP_NAME}.jar"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# JVM参数
|
||||
@ -13,6 +12,9 @@ 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)
|
||||
@ -27,10 +29,8 @@ mkdir -p ${LOG_HOME}
|
||||
|
||||
# 启动服务
|
||||
echo "Starting ${APP_NAME}..."
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE \
|
||||
--spring.config.location=${APP_HOME}/application.yml \
|
||||
> /dev/null 2>&1 &
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE $CONFIG_OPTS > /dev/null 2>&1 &
|
||||
|
||||
# 保存PID
|
||||
echo $! > $PID_FILE
|
||||
echo $\! > $PID_FILE
|
||||
echo "${APP_NAME} started (PID: $(cat $PID_FILE))"
|
||||
25
fund-report/src/main/scripts/status.sh
Executable file
25
fund-report/src/main/scripts/status.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#\!/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,18 +1,17 @@
|
||||
#!/bin/bash
|
||||
# fund-report 服务停止脚本
|
||||
|
||||
#\!/bin/bash
|
||||
# 服务停止脚本
|
||||
APP_NAME="fund-report"
|
||||
APP_HOME="/opt/fundplatform/deploy/${APP_NAME}"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# 检查是否运行
|
||||
if [ ! -f "$PID_FILE" ]; then
|
||||
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
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
echo "${APP_NAME} is not running"
|
||||
rm -f $PID_FILE
|
||||
exit 0
|
||||
@ -24,7 +23,7 @@ kill $PID
|
||||
|
||||
# 等待停止
|
||||
for i in {1..30}; do
|
||||
if ! ps -p $PID > /dev/null 2>&1; then
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
@ -65,6 +65,31 @@
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Maven Assembly Plugin - 打包为tar.gz -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
43
fund-req/src/main/assembly/assembly.xml
Normal file
43
fund-req/src/main/assembly/assembly.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<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>
|
||||
7
fund-req/src/main/scripts/restart.sh
Executable file
7
fund-req/src/main/scripts/restart.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#\!/bin/bash
|
||||
# 服务重启脚本
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
${SCRIPT_DIR}/stop.sh
|
||||
sleep 3
|
||||
${SCRIPT_DIR}/start.sh
|
||||
@ -1,10 +1,9 @@
|
||||
#!/bin/bash
|
||||
# fund-req 服务启动脚本
|
||||
|
||||
#\!/bin/bash
|
||||
# 服务启动脚本
|
||||
APP_NAME="fund-req"
|
||||
APP_HOME="/opt/fundplatform/deploy/${APP_NAME}"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
LOG_HOME="/datacfs/applogs/${APP_NAME}"
|
||||
JAR_FILE="${APP_HOME}/${APP_NAME}.jar"
|
||||
JAR_FILE="${APP_HOME}/lib/${APP_NAME}.jar"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# JVM参数
|
||||
@ -13,6 +12,9 @@ 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)
|
||||
@ -27,10 +29,8 @@ mkdir -p ${LOG_HOME}
|
||||
|
||||
# 启动服务
|
||||
echo "Starting ${APP_NAME}..."
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE \
|
||||
--spring.config.location=${APP_HOME}/application.yml \
|
||||
> /dev/null 2>&1 &
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE $CONFIG_OPTS > /dev/null 2>&1 &
|
||||
|
||||
# 保存PID
|
||||
echo $! > $PID_FILE
|
||||
echo $\! > $PID_FILE
|
||||
echo "${APP_NAME} started (PID: $(cat $PID_FILE))"
|
||||
25
fund-req/src/main/scripts/status.sh
Executable file
25
fund-req/src/main/scripts/status.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#\!/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,18 +1,17 @@
|
||||
#!/bin/bash
|
||||
# fund-req 服务停止脚本
|
||||
|
||||
#\!/bin/bash
|
||||
# 服务停止脚本
|
||||
APP_NAME="fund-req"
|
||||
APP_HOME="/opt/fundplatform/deploy/${APP_NAME}"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# 检查是否运行
|
||||
if [ ! -f "$PID_FILE" ]; then
|
||||
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
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
echo "${APP_NAME} is not running"
|
||||
rm -f $PID_FILE
|
||||
exit 0
|
||||
@ -24,7 +23,7 @@ kill $PID
|
||||
|
||||
# 等待停止
|
||||
for i in {1..30}; do
|
||||
if ! ps -p $PID > /dev/null 2>&1; then
|
||||
if \! ps -p $PID > /dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
@ -109,9 +109,36 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Spring Boot Maven Plugin -->
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- Maven Assembly Plugin - 打包为tar.gz -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
43
fund-sys/src/main/assembly/assembly.xml
Normal file
43
fund-sys/src/main/assembly/assembly.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<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>
|
||||
3
server-deploy/fund-req/restart.sh → fund-sys/src/main/scripts/restart.sh
Executable file → Normal file
3
server-deploy/fund-req/restart.sh → fund-sys/src/main/scripts/restart.sh
Executable file → Normal file
@ -1,6 +1,5 @@
|
||||
#!/bin/bash
|
||||
# fund-req 服务重启脚本
|
||||
|
||||
# 服务重启脚本
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
${SCRIPT_DIR}/stop.sh
|
||||
14
server-deploy/fund-sys/start.sh → fund-sys/src/main/scripts/start.sh
Executable file → Normal file
14
server-deploy/fund-sys/start.sh → fund-sys/src/main/scripts/start.sh
Executable file → Normal file
@ -1,10 +1,9 @@
|
||||
#!/bin/bash
|
||||
# fund-sys 服务启动脚本
|
||||
|
||||
# 服务启动脚本
|
||||
APP_NAME="fund-sys"
|
||||
APP_HOME="/opt/fundplatform/deploy/${APP_NAME}"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
LOG_HOME="/datacfs/applogs/${APP_NAME}"
|
||||
JAR_FILE="${APP_HOME}/${APP_NAME}.jar"
|
||||
JAR_FILE="${APP_HOME}/lib/${APP_NAME}.jar"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# JVM参数
|
||||
@ -13,6 +12,9 @@ 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)
|
||||
@ -27,9 +29,7 @@ mkdir -p ${LOG_HOME}
|
||||
|
||||
# 启动服务
|
||||
echo "Starting ${APP_NAME}..."
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE \
|
||||
--spring.config.location=${APP_HOME}/application.yml \
|
||||
> /dev/null 2>&1 &
|
||||
nohup java $JAVA_OPTS $LOG_OPTS -jar $JAR_FILE $CONFIG_OPTS > /dev/null 2>&1 &
|
||||
|
||||
# 保存PID
|
||||
echo $! > $PID_FILE
|
||||
26
fund-sys/src/main/scripts/status.sh
Normal file
26
fund-sys/src/main/scripts/status.sh
Normal file
@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
# 查看服务状态
|
||||
APP_NAME="fund-sys"
|
||||
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 "=========================================="
|
||||
5
server-deploy/fund-sys/stop.sh → fund-sys/src/main/scripts/stop.sh
Executable file → Normal file
5
server-deploy/fund-sys/stop.sh → fund-sys/src/main/scripts/stop.sh
Executable file → Normal file
@ -1,8 +1,7 @@
|
||||
#!/bin/bash
|
||||
# fund-sys 服务停止脚本
|
||||
|
||||
# 服务停止脚本
|
||||
APP_NAME="fund-sys"
|
||||
APP_HOME="/opt/fundplatform/deploy/${APP_NAME}"
|
||||
APP_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# 检查是否运行
|
||||
63
server-deploy/assembly/assembly.xml
Normal file
63
server-deploy/assembly/assembly.xml
Normal file
@ -0,0 +1,63 @@
|
||||
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.2.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.2.0 https://maven.apache.org/xsd/assembly-2.2.0.xsd">
|
||||
|
||||
<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>
|
||||
<filtered>true</filtered>
|
||||
</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>
|
||||
|
||||
<!-- lib目录 - 依赖JAR -->
|
||||
<fileSet>
|
||||
<directory>${project.build.directory}/dependency</directory>
|
||||
<outputDirectory>lib</outputDirectory>
|
||||
<includes>
|
||||
<include>*.jar</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>${project.artifactId}-${project.version}.jar</exclude>
|
||||
</excludes>
|
||||
<fileMode>0644</fileMode>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
|
||||
<files>
|
||||
<!-- 主JAR包 -->
|
||||
<file>
|
||||
<source>${project.build.directory}/${project.artifactId}-${project.version}.jar</source>
|
||||
<outputDirectory>lib</outputDirectory>
|
||||
<destName>${project.artifactId}.jar</destName>
|
||||
<fileMode>0644</fileMode>
|
||||
</file>
|
||||
</files>
|
||||
|
||||
</assembly>
|
||||
@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
# fund-cust 服务重启脚本
|
||||
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
${SCRIPT_DIR}/stop.sh
|
||||
sleep 3
|
||||
${SCRIPT_DIR}/start.sh
|
||||
@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
# fund-file 服务重启脚本
|
||||
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
${SCRIPT_DIR}/stop.sh
|
||||
sleep 3
|
||||
${SCRIPT_DIR}/start.sh
|
||||
@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
# fund-gateway 服务重启脚本
|
||||
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
${SCRIPT_DIR}/stop.sh
|
||||
sleep 3
|
||||
${SCRIPT_DIR}/start.sh
|
||||
@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
# fund-receipt 服务重启脚本
|
||||
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
${SCRIPT_DIR}/stop.sh
|
||||
sleep 3
|
||||
${SCRIPT_DIR}/start.sh
|
||||
@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
# fund-report 服务重启脚本
|
||||
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
|
||||
${SCRIPT_DIR}/stop.sh
|
||||
sleep 3
|
||||
${SCRIPT_DIR}/start.sh
|
||||
0
server-deploy/restart-all.sh → server-deploy/scripts/restart-all.sh
Executable file → Normal file
0
server-deploy/restart-all.sh → server-deploy/scripts/restart-all.sh
Executable file → Normal file
9
server-deploy/scripts/restart.sh
Normal file
9
server-deploy/scripts/restart.sh
Normal file
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
# 服务重启脚本
|
||||
# 用法: ./restart.sh [服务名称]
|
||||
|
||||
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
||||
|
||||
${SCRIPT_DIR}/stop.sh
|
||||
sleep 3
|
||||
${SCRIPT_DIR}/start.sh
|
||||
6
server-deploy/start-all.sh → server-deploy/scripts/start-all.sh
Executable file → Normal file
6
server-deploy/start-all.sh → server-deploy/scripts/start-all.sh
Executable file → Normal file
@ -21,13 +21,13 @@ echo " Starting all services..."
|
||||
echo "=========================================="
|
||||
|
||||
for service in "${SERVICES[@]}"; do
|
||||
if [ -f "${DEPLOY_HOME}/${service}/start.sh" ]; then
|
||||
if [ -f "${DEPLOY_HOME}/${service}/bin/start.sh" ]; then
|
||||
echo ""
|
||||
echo "Starting ${service}..."
|
||||
${DEPLOY_HOME}/${service}/start.sh
|
||||
${DEPLOY_HOME}/${service}/bin/start.sh
|
||||
sleep 5
|
||||
else
|
||||
echo "Warning: ${service}/start.sh not found, skipping..."
|
||||
echo "Warning: ${service}/bin/start.sh not found, skipping..."
|
||||
fi
|
||||
done
|
||||
|
||||
41
server-deploy/scripts/start.sh
Normal file
41
server-deploy/scripts/start.sh
Normal file
@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
# 服务启动脚本
|
||||
# 用法: ./start.sh [服务名称]
|
||||
|
||||
# 获取服务名称(从脚本所在目录推断)
|
||||
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
||||
APP_HOME=$(dirname "$SCRIPT_DIR")
|
||||
APP_NAME=$(basename "$APP_HOME")
|
||||
|
||||
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))"
|
||||
0
server-deploy/status.sh → server-deploy/scripts/status-all.sh
Executable file → Normal file
0
server-deploy/status.sh → server-deploy/scripts/status-all.sh
Executable file → Normal file
32
server-deploy/scripts/status.sh
Normal file
32
server-deploy/scripts/status.sh
Normal file
@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
# 查看服务状态
|
||||
# 用法: ./status.sh [服务名称]
|
||||
|
||||
# 获取服务名称(从脚本所在目录推断)
|
||||
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
||||
APP_HOME=$(dirname "$SCRIPT_DIR")
|
||||
APP_NAME=$(basename "$APP_HOME}")
|
||||
|
||||
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 "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 "Status: \033[31mSTOPPED\033[0m (stale PID file)"
|
||||
rm -f $PID_FILE
|
||||
fi
|
||||
else
|
||||
echo "Status: \033[31mSTOPPED\033[0m"
|
||||
fi
|
||||
|
||||
echo "=========================================="
|
||||
6
server-deploy/stop-all.sh → server-deploy/scripts/stop-all.sh
Executable file → Normal file
6
server-deploy/stop-all.sh → server-deploy/scripts/stop-all.sh
Executable file → Normal file
@ -21,13 +21,13 @@ echo " Stopping all services..."
|
||||
echo "=========================================="
|
||||
|
||||
for service in "${SERVICES[@]}"; do
|
||||
if [ -f "${DEPLOY_HOME}/${service}/stop.sh" ]; then
|
||||
if [ -f "${DEPLOY_HOME}/${service}/bin/stop.sh" ]; then
|
||||
echo ""
|
||||
echo "Stopping ${service}..."
|
||||
${DEPLOY_HOME}/${service}/stop.sh
|
||||
${DEPLOY_HOME}/${service}/bin/stop.sh
|
||||
sleep 2
|
||||
else
|
||||
echo "Warning: ${service}/stop.sh not found, skipping..."
|
||||
echo "Warning: ${service}/bin/stop.sh not found, skipping..."
|
||||
fi
|
||||
done
|
||||
|
||||
10
server-deploy/fund-gateway/stop.sh → server-deploy/scripts/stop.sh
Executable file → Normal file
10
server-deploy/fund-gateway/stop.sh → server-deploy/scripts/stop.sh
Executable file → Normal file
@ -1,8 +1,12 @@
|
||||
#!/bin/bash
|
||||
# fund-gateway 服务停止脚本
|
||||
# 服务停止脚本
|
||||
# 用法: ./stop.sh [服务名称]
|
||||
|
||||
# 获取服务名称(从脚本所在目录推断)
|
||||
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
|
||||
APP_HOME=$(dirname "$SCRIPT_DIR")
|
||||
APP_NAME=$(basename "$APP_HOME")
|
||||
|
||||
APP_NAME="fund-gateway"
|
||||
APP_HOME="/opt/fundplatform/deploy/${APP_NAME}"
|
||||
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
|
||||
|
||||
# 检查是否运行
|
||||
Loading…
x
Reference in New Issue
Block a user