455884401f
Co-authored-by: chenshuobo <1119780489@qq.com> Reviewed-on: #38
34 lines
1.4 KiB
Desktop File
34 lines
1.4 KiB
Desktop File
# 美团 CPS 券 ETL —— 单轮抓取入库,由 meituan-etl.timer 每小时触发(Linux 服务器用)。
|
|
#
|
|
# 仅用于 mentor 的 Linux 服务器;本机 Windows 开发无 systemd,直接手动跑脚本即可:
|
|
# .venv\Scripts\python -m scripts.pull_meituan_coupons --once --prune-hours 24
|
|
#
|
|
# 部署(服务器):
|
|
# sudo cp deploy/meituan-etl.{service,timer} /etc/systemd/system/
|
|
# sudo systemctl daemon-reload && sudo systemctl enable --now meituan-etl.timer
|
|
#
|
|
# 前置:DATABASE_URL 必须是 postgresql+psycopg://(ETL 的 upsert 是 PG 专用);
|
|
# MT_CPS_APP_KEY/SECRET 已配;服务器上 MT_CPS_PROXY 留空(直连)。
|
|
[Unit]
|
|
Description=Meituan CPS coupon ETL (one-shot, driven by timer)
|
|
After=network-online.target postgresql.service
|
|
Wants=network-online.target postgresql.service
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
User=root
|
|
WorkingDirectory=/opt/shaguabijia-app-server
|
|
Environment="PATH=/opt/shaguabijia-app-server/.venv/bin:/usr/bin:/bin"
|
|
EnvironmentFile=/opt/shaguabijia-app-server/.env
|
|
ExecStart=/opt/shaguabijia-app-server/.venv/bin/python -m scripts.pull_meituan_coupons --once --prune-hours 24
|
|
SyslogIdentifier=meituan-etl
|
|
# 脚本自带 30min 文件锁;给 20min 硬超时,防卡死轮次长期占锁。
|
|
TimeoutStartSec=1200
|
|
|
|
# 与主服务 shaguabijia-app-server.service 同款加固。
|
|
NoNewPrivileges=true
|
|
PrivateTmp=true
|
|
ProtectSystem=strict
|
|
ReadWritePaths=/opt/shaguabijia-app-server
|
|
ProtectHome=true
|