这真的很烦人,systemd
只回应我的服务文件配置错误,但没有具体指出错误在哪里:
/lib/systemd/system/auto_pgha.service
:
[Unit]
Description=PostgreSQL High Availability
After=network.service
After=firewalld.service
[Service]
Type=simple
WorkingDirectory=/etc/repmgr
ExecStartPre=/bin/bash -c 'echo -e "\n" `date +"%Y/%m/%d %a, %X"`": STARTING \n" >> pgha.log'
ExecStart=/bin/bash -c "python3 pg_high_availability.py &>> pgha.log"
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
在目录内/etc/repmgr
这两个命令运行得很好。但 systemd 服务只是响应了一个错误:
# systemctl start auto_pgha
Failed to start auto_pgha.service: Unit auto_pgha.service has a bad unit file setting.
See system logs and 'systemctl status auto_pgha.service' for details.
# systemctl status -l auto_pgha
○ auto_pgha.service - PostgreSQL High Availability
Loaded: bad-setting (Reason: Unit auto_pgha.service has a bad unit file setting.)
......
auto_pgha.service: Unit configuration has fatal error, unit will not be be started.