Moving the data directory for systemd service startup - Mailing list pgsql-admin

From Evan Rempel
Subject Moving the data directory for systemd service startup
Date
Msg-id 56130215-3c42-69cd-2d01-6f8aea6da46a@uvic.ca
Whole thread Raw
Responses Re: Moving the data directory for systemd service startup  (Johannes Truschnigg <johannes@truschnigg.info>)
RE: Moving the data directory for systemd service startup  (Michael Ireland <mireland@esri.com>)
List pgsql-admin
I am using the official RPMs for RHEL-7 and am having difficulty in using a different database directory than the
default of

/var/lib/pgsql/9.6/data/
or
/var/lib/pgsql/10/data/


It is easy to modify the service file

/usr/lib/systemd/system/postgresql-9.6.service

with the line

Environment=PGDATA=/var/lib/pgsql/9.6/data/

to point to the location I want, but an RPM update will replace this file and break database startup.

I was hoping that there would be a line

EnvironmentFile=-/etc/sysconfig/pgsql/postgresql-9.6

or

EnvironmentFile=-/etc/sysconfig/pgsql/postgresql-10

to allow for customization of the environment variables, similar to the init.d startup, but I don't see one.


Am I missing something, or is the configuration of the systemd unit file an oversight?

Any information would be helpful.

Evan.



pgsql-admin by date:

Previous
From: Sohel Tamboli
Date:
Subject: Upgrade postgresql from 9.1 to 9.6
Next
From: Ron
Date:
Subject: Re: Upgrade postgresql from 9.1 to 9.6