Comment by xerxes901
14 hours ago
Put a script in /etc/systemd/system-generators/ that does something like
if grep "logging = syslog" /etc/stupid-service/stupid-service.conf >/dev/null; then
printf "[Unit]\nAfter=rsyslogd.service\n" > "$1/stupid-service.d/10-syslog-dep.conf";
fi;
> It's pretty basic and straightforward
Postgres config supports line continuations, so the OpenRC service file you quoted is buggy; it could potentially match a file just because some other option contained a multi-line value that had the string "log_destination = syslog" in it.
The whole philosophy of systemd is to move away from these kinds of "simple" and "mostly working" pile-of-shell-script systems to actually-unconditionally-correct configuration that doesn't come with bonus text processing surprises.
> Postgres config supports line continuations, so the OpenRC service file you quoted is buggy; ...
Where's that documented?
I tried the obvious things followed by a config reload. Here are the results (the 'log_destination' parameter is on line 482 of the config file):
What's the line continuation character for 'postgresql.conf'? Are you certain that you're not getting 'postgresql.conf' confused with 'pg_hba.conf'? That file is documented to support line continuations: [0]
> The whole philosophy of systemd is to move ... to actually-unconditionally-correct configuration that doesn't come with bonus text processing surprises.
That's truly a lovely and laudable goal. In this system, how does you propose one processes a flat text config file with a mix of 'K = V' and 'K V' settings without doing ordinary, boring text processing? Do you propose that one waits until "systemd-configd" gets created and every daemon of any importance is updated to put its config in there instead of in flat files? If so, has there been any notable progress on this in the last ~fifteen years?
> Put a script in /etc/systemd/system-generators/...
Thanks for finally answering my question. Is the way to conditionally update service dependencies really to dump text files in magic locations? Is there no 'systemctl' (or similar) command that allows one to manipulate dependencies for a specific service that one can call from a generator?
[0] <https://www.postgresql.org/docs/17/auth-pg-hba-conf.html>