I run two instances of PostgreSQL on a CentOS 7 server, and I'm working on converting the SysV-style init scripts to systemd units. The problem is that the PostgreSQL RPM comes with a single, non-template, service unit file.
As far as I can tell, I have to choose between a few unpleasant options:
- I can use the deprecated
.include
directive to create two customized units under /etc/systemd/system. The current service file actually advises using.include
for customization, but I know the directive has been deprecated, which means it might stop working in the future. - I can duplicate the unit file, but then I risk diverging when eventually the original unit files gets updated but the copied unit file doesn't.
- I can create a template based on the existing unit file, which means my units will either both work well or not, but they still won't get updated when the upstream unit file gets updated.
Is there a better way? This seems like a common use case, for people who want to run multiple DB servers, or multiple SSH daemons, or multiple http servers on the same machine.