# 每日 Postgres 备份服务(HA 阶段 0)。 # # 注意:unit 文件不在 deploy tar 里,改动后须单独 scp 到 # /etc/systemd/system/ 再 daemon-reload + enable + start,不要只重启服务。 # 本 service 以 root 跑,只因为要读 0600 的 /etc/codex-app-server/env; # 备份文件由 UMask=0077 压成 600,目录由 pg-backup.sh 压成 700。 [Unit] Description=Daily Postgres backup for codex-app-server # 注意:codex-postgres 是 docker 容器、不是 systemd 服务,这里不写 # After/Wants;Postgres 不可达时 pg_dump 直接失败、service 失败可见。 [Service] Type=oneshot User=root UMask=0077 EnvironmentFile=/etc/codex-app-server/env ExecStart=/bin/sh /opt/codex-app-server/deploy/pg-backup.sh