#!/bin/bash # 启动emotion-single服务脚本 # 作者: emotion-museum # 日期: 2025-07-21 echo "🛑 停止旧的微服务..." pkill -f 'emotion-.*\.jar' 2>/dev/null || echo "没有找到emotion相关进程" sleep 3 echo "🚀 启动emotion-single服务..." cd /data/builds # 创建日志目录 mkdir -p /data/logs/emotion-museum # 启动服务 nohup java -Xms256m -Xmx512m \ -Dspring.profiles.active=simple \ -Dserver.port=8080 \ -jar emotion-single-1.0.0.jar \ > /data/logs/emotion-museum/emotion-single.log 2>&1 & echo "⏳ 等待服务启动..." sleep 20 # 检查进程 if pgrep -f emotion-single-1.0.0.jar > /dev/null; then echo "✅ 服务进程启动成功" ps aux | grep emotion-single-1.0.0.jar | grep -v grep else echo "❌ 服务进程启动失败" tail -20 /data/logs/emotion-museum/emotion-single.log exit 1 fi # 检查端口 if netstat -tlnp | grep :8080 > /dev/null; then echo "✅ 服务端口8080正在监听" else echo "⚠️ 服务端口8080未监听,查看日志..." tail -10 /data/logs/emotion-museum/emotion-single.log fi echo "" echo "📋 服务信息:" echo " 健康检查: http://47.111.10.27:8080/api/health" echo " 服务信息: http://47.111.10.27:8080/api/health/info" echo " 前端页面: http://47.111.10.27/emotion/happy/" echo "" echo "🔧 查看日志: tail -f /data/logs/emotion-museum/emotion-single.log"