#!/bin/bash # fam-notifier 启动脚本(NAS 端) # 用法: bash scripts/start_notifier.sh # # NAS 上没有 systemd,挂了不会自启——重启方式见 docs/DEPLOY.md §1.2。 set -e APP_DIR="$(cd "$(dirname "$0")/.." && pwd)" CONFIG_FILE="$APP_DIR/config/config.yaml" if [ ! -f "$CONFIG_FILE" ]; then echo "错误: 配置文件不存在: $CONFIG_FILE" echo "请复制 config/config.yaml.example 为 config.yaml 并填入实际值" exit 1 fi cd "$APP_DIR" # 加载 DSM_ACCOUNT / DSM_PASSWORD / ORACLE_SYNC_TOKEN。 # set -a 包裹:.env 里是裸赋值,不 export 的话子进程读不到(2026-09-01 踩过)。 ENV_FILE="$APP_DIR/../.env" if [ -f "$ENV_FILE" ]; then set -a source "$ENV_FILE" set +a fi if [ -d "venv" ]; then source venv/bin/activate fi # 包在 src/ 下,不加这行 `python -m fam_notifier` 找不到模块 export PYTHONPATH="$APP_DIR/src${PYTHONPATH:+:$PYTHONPATH}" echo "启动 fam-notifier(轮询 Surveillance Station -> 推送甲骨文)..." exec python -m fam_notifier