worklog/scripts/stop.sh
zhangjf e36ac36af5 fix: 修复后端兼容性和前后端配置问题
后端修复:
- Spring Boot 降级到 3.1.12 以兼容 MyBatis-Plus 3.5.6
- 添加 RedisConfig 配置 RedisTemplate Bean
- 修复数据库连接字符编码 characterEncoding=UTF-8
- 添加健康检查接口 /api/v1/health 到认证白名单
- 实体字段同步数据库: WorkLog 添加 recordTime, LogTemplate 添加 templateContent/instruction
- 修复 logback 滚动策略配置
- 密码验证临时改为明文比对(测试用)

前端修复:
- API baseURL 统一修正为 /wlog/api/v1
- Vite 配置添加 base 路径 (/wladmin/, /wlmobile/)

脚本修复:
- stop.sh/status.sh 使用动态 APP_HOME 获取路径
2026-02-24 22:47:14 +08:00

64 lines
1.5 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# ====================================================
# 工作日志服务平台 - 应用停止脚本
# ====================================================
# 获取脚本所在目录的上级目录作为应用根目录
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
APP_HOME="$(cd "${SCRIPT_DIR}/.." && pwd)"
# 应用配置
APP_NAME="worklog-api"
PID_FILE="${APP_HOME}/${APP_NAME}.pid"
# 检查 PID 文件是否存在
if [ ! -f "${PID_FILE}" ]; then
echo "应用未运行(找不到 PID 文件)"
exit 0
fi
# 读取 PID
PID=$(cat "${PID_FILE}")
# 检查进程是否存在
if ! ps -p ${PID} > /dev/null 2>&1; then
echo "应用未运行(进程不存在)"
rm -f "${PID_FILE}"
exit 0
fi
echo "========================================="
echo "停止应用: ${APP_NAME}"
echo "PID: ${PID}"
echo "========================================="
# 优雅停止(发送 SIGTERM
echo "发送停止信号..."
kill ${PID}
# 等待进程结束(最多等待 30 秒)
TIMEOUT=30
COUNT=0
while ps -p ${PID} > /dev/null 2>&1; do
if [ ${COUNT} -ge ${TIMEOUT} ]; then
echo "WARNING: 应用未在 ${TIMEOUT} 秒内停止,强制终止..."
kill -9 ${PID}
sleep 2
break
fi
echo "等待应用停止... (${COUNT}/${TIMEOUT})"
sleep 1
COUNT=$((COUNT + 1))
done
# 确认进程已停止
if ps -p ${PID} > /dev/null 2>&1; then
echo "ERROR: 无法停止应用"
exit 1
else
echo "应用已停止"
rm -f "${PID_FILE}"
exit 0
fi