kindergarten_java/stop-all.sh
2026-02-28 16:41:39 +08:00

40 lines
950 B
Bash
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
# 统一停止脚本 - 停止前后端服务
echo "======================================"
echo " 停止幼儿阅读教学服务平台"
echo "======================================"
echo ""
# 停止后端
echo "🛑 停止后端服务..."
if lsof -ti:3000 > /dev/null 2>&1; then
lsof -ti:3000 | xargs kill -9 2>/dev/null
echo "✅ 后端服务已停止"
else
echo " 后端服务未运行"
fi
# 停止前端
echo "🛑 停止前端服务..."
if lsof -ti:5173 > /dev/null 2>&1; then
lsof -ti:5173 | xargs kill -9 2>/dev/null
echo "✅ 前端服务已停止"
else
echo " 前端服务未运行"
fi
# 清理日志文件(可选)
read -p "是否清理日志文件? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
rm -f /tmp/reading-platform-backend.log
rm -f /tmp/reading-platform-frontend.log
echo "✅ 日志文件已清理"
fi
echo ""
echo "✅ 所有服务已停止"
echo ""