[Unit] Description=新闻联播每日抓取入库(下载 → 识别 → 校对 → 切分 → 入库 → 清理) Documentation=file:///home/pi/project/xwlb/README.md # 数据库走 autossh 隧道,隧道由独立服务托管,随本服务一起拉起 Wants=network-online.target xwlb-tunnel.service After=network-online.target xwlb-tunnel.service [Service] Type=oneshot User=pi Group=pi WorkingDirectory=/home/pi/project/xwlb # 失败重试(21:30 / 22:00)在脚本内部完成,因此可能持续到 2~3 小时; # systemd 默认 TimeoutStartSec=90s 会把服务砍掉,必须放大。 TimeoutStartSec=10800 # 成败由脚本退出码体现,不用 systemd 反复重启 Restart=no StandardOutput=journal StandardError=journal SyslogIdentifier=xwlb-daily UMask=0077 Environment=PYTHONUNBUFFERED=1 ExecStart=/home/pi/project/xwlb/scripts/run_daily.sh # 轻量加固:只读保护系统目录,不动 $HOME(yt-dlp 需要写 ~/.cache) NoNewPrivileges=yes PrivateTmp=yes ProtectSystem=full [Install] WantedBy=multi-user.target