Re: initlocation and createdb - Mailing list pgsql-general

From Jeff Hoffmann
Subject Re: initlocation and createdb
Date
Msg-id 394701FB.DA0C396B@propertykey.com
Whole thread Raw
In response to RE: initlocation and createdb  ("Barnes" <aardvark@ibm.net>)
List pgsql-general
Barnes wrote:
>
> Thank you.  This works, and is close to what I need, but if I don't launch
> the postmaster from a window with PGDATA2 defined, such as is done with
> "/etc/init.d/postgresql start" or on a system boot, then it doesn't work.  I
> tried to export PGDATA2 within /etc/init.d/postgresql, but that didn't work
> for me.
>
> Can I make this work from within /etc/init.d/postgresql, or do have to start
> the postmaster from a shell with the PGDATA2 already defined?
>
> Thanks again.

i'm not 100% sure that this works in all environments, but if your
startup script does a "su -l <username> -c ...", that's likely your
problem.  on the systems that i'm familiar with, the -l flag on su will
reset the environment & read the shell startup files (e.g., .profile).
so if you set the variable earlier in the script, it will be cleared out
before the program is actually run.   the .profile should be read when
the su is invoked & then variable should be available to you then.

hope this helps,

jeff

pgsql-general by date:

Previous
From: Luis Martins
Date:
Subject: Large objects
Next
From: "T.J.Farrell"
Date:
Subject: PostgreSQL and multiple database access