Re: initdb $PGDATA not working

From: Alan Hodgson <ahodgson(at)simkin(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: initdb $PGDATA not working
Date: 2012-02-09 21:43:57
Message-ID: 1360265.s3EXKmhkko@skynet.simkin.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2012-02-09 21:54:21 Re: initdb $PGDATA not working
Previous Message Andy Colson 2012-02-09 21:39:26 Re: initdb $PGDATA not working