e2fd864bdc
把 scripts/pull_meituan_coupons.py 跑成定时任务,持续给 meituan_coupon 表灌数据(销量榜 /api/v1/meituan/top-sales 的数据源)。两个 unit: - meituan-etl.service: oneshot,跑 `python -m scripts.pull_meituan_coupons --once --prune-hours 24`;EnvironmentFile 复用 .env 拿 MT_CPS 凭证 / DATABASE_URL - meituan-etl.timer: OnActiveSec=1min(启用即跑,首次 1 分钟内)+ OnUnitActiveSec=1h(之后每隔 1 小时)。不用 OnActiveSec=0——本机 systemd 对 0 + OnUnitActiveSec 报 Result=resources 拒绝加载 已部署 ecs1(scp 到 /etc/systemd/system/ + enable --now),首轮 success、 top-sales 接口返回带销量排序数据。安装/运维说明见 docs 仓库的 运维/销量榜feed排序_变更与部署记录.md。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
18 lines
664 B
Desktop File
18 lines
664 B
Desktop File
[Unit]
|
|
Description=Shaguabijia Meituan CPS coupon ETL (灌 meituan_coupon 供销量/佣金排序)
|
|
After=network-online.target postgresql.service
|
|
Wants=network-online.target
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
User=root
|
|
WorkingDirectory=/opt/shaguabijia-app-server
|
|
# 复用 app-server 的 .env(MT_CPS 凭证 / DATABASE_URL),与 shaguabijia-app-server.service 同源
|
|
EnvironmentFile=/opt/shaguabijia-app-server/.env
|
|
Environment=PYTHONUNBUFFERED=1
|
|
ExecStart=/opt/shaguabijia-app-server/.venv/bin/python -m scripts.pull_meituan_coupons --once --prune-hours 24
|
|
# 北京一轮正常 ~2-3min,给 15min 上限防卡死
|
|
TimeoutStartSec=900
|
|
StandardOutput=journal
|
|
StandardError=journal
|