#!/bin/bash # 新用户注册邮件通知服务 - 启动脚本 set -e SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$SCRIPT_DIR" GREEN='\033[0;32m' YELLOW='\033[1;33m' RED='\033[0;31m' BLUE='\033[0;34m' NC='\033[0m' CONF_FILE="$SCRIPT_DIR/send_new_user.conf" if [ ! -f "$CONF_FILE" ]; then echo -e "${RED}❌ 未找到配置文件 $CONF_FILE${NC}" exit 1 fi echo -e "${GREEN}✅ 配置文件: $CONF_FILE${NC}" if ! command -v python3 &> /dev/null; then echo -e "${RED}❌ 未找到 python3${NC}" exit 1 fi if [ -d "venv" ]; then source venv/bin/activate elif [ -d ".venv" ]; then source .venv/bin/activate fi echo -e "${BLUE}📧 启动新用户注册邮件通知服务...${NC}" nohup python3 send_new_user_email.py > send_new_user_email_nohup.log 2>&1 & echo $! > send_new_user_email.pid echo -e "${GREEN}✅ 服务已启动,PID: $(cat send_new_user_email.pid)${NC}" echo -e "${YELLOW}日志: send_new_user_email.log, send_new_user_email_error.log${NC}"