This is really annoying that systemd
only responded that my configuration of a service file is wrong, but does not specify where is wrong exactly:
/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
Inside directory /etc/repmgr
the two commands worked just fine. But the systemd service just responded with an error:
# 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.
You can use the
systemd-analyze verify
command. If we put the content from your question intopgha.service
, we see:You're getting this error because systemd itself uses
%<something>
tokens (see the "Specifiers" section of thesystemd.unit(5)
man page.You would need to write: