9.5 CentOS 7 setting PGDATA for systemctl

From: Tory M Blue <tmblue(at)gmail(dot)com>
To: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: 9.5 CentOS 7 setting PGDATA for systemctl
Date: 2016-05-22 05:27:08
Message-ID: CAEaSS0Zt-Jc5c9AxeZZsmvybR3CfAXyCUQQ8+-OLwdcG9aaWOw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Evening, morning, or afternoon,

So I'm trying to go back to a stock rpm package (vs my full custom,
builds). This is a learning curve, not only because it's all "whacked
pathing (in my eyes:)) but rhel7 is a #$%$# with all the things they
changed.

Sooo

I've got servers built and I've got the correct data path initialized
and postgres can start the db " /usr/pgsql-9.5/bin/pg_ctl -D
/pgsql/9.5/data -l logfile start"

But obviously systemctl start postgresql-9.5.server loses it's head
because it has no idea where my Data directory is and setting , PGDATA
as a variable, doesn't seem to work.

So how do I kick CentOS 7 in the teeth and make it change it's
attitude regarding where I have put things? /var/lib/pgsql (really?)
I don't want to do symlinks.

I've got it installed and running, but postgres can't be the only
place to start/stop the server. I need systemctl to handle these tasks
as well.

The init program is all kinds of weirdness.

Any pointers, as I'm starting to lose sleep over this! :)

Thanks
Tory

PGDATA=`sed -n 's/Environment=PGDATA=//p' "${SERVICE_FILE}"`

and

# this parsing technique fails for PGDATA pathnames containing spaces,

# but there's not much I can do about it given systemctl's output format...

PGDATA=`systemctl show -p Environment "${SERVICE_NAME}.service" |

sed 's/^Environment=//' | tr ' ' '\n' |

sed -n 's/^PGDATA=//p' | tail -n 1`

if [ x"$PGDATA" = x ]; then

echo "failed to find PGDATA setting in ${SERVICE_NAME}.service"

exit 1

fi

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Venkata Balaji N 2016-05-22 08:38:36 Re: postgresql-9.5.3 compilation on Solaris SPARC
Previous Message dandl 2016-05-22 01:31:51 Re: How to know if SPI or some other API triggered an ERROR.