Re: initdb $PGDATA not working - Mailing list pgsql-general

From Alan Hodgson
Subject Re: initdb $PGDATA not working
Date
Msg-id 1360265.s3EXKmhkko@skynet.simkin.ca
Whole thread Raw
In response to initdb $PGDATA not working  (Daniel Vázquez <daniel2d2art@gmail.com>)
List pgsql-general
On Thursday, February 09, 2012 10:25:51 PM Daniel Vázquez wrote:
> Hi!
>
> I've set my PGDATA variable in profile
> export PGDATA=/home/mydata/pgsql/data
>
> Testing variable for correct set in enviroment
> $ echo $PGDATA
> /home/mydata/pgsql/data
>
> but when execute:
> $ sudo /etc/init.d/postgresql-9.1 initdb
>
> or execute:
> $ sudo /etc/init.d/postgresql-9.1 initdb -D /home/mydata/pgsql/data
>
> The cluster always is created on default path "/var/lib/pgsql/9.1/data/"
>
> Will install in CentOS 5.7

The init script doesn't take command line options except the initdb action.
And it sets PGDATA itself.

Perhaps su postgres -c "initdb -D /home/mydata/pgsql/data" or something
similar might work better. Or modifying the init script before using it, which
would have the advantage that it might also start the server later using your
new data directory.


pgsql-general by date:

Previous
From: Andy Colson
Date:
Subject: Re: initdb $PGDATA not working
Next
From: John R Pierce
Date:
Subject: Re: initdb $PGDATA not working