> I want to set up a database in a directory other than
> /var/lib/pgsql/data/, so in both postgres' ~/.bash_profile and my
> ~/.bash_profile I added the line:
>
> PGDATA2="/opt/paisley/"; export PGDATA2
>
<snip>
> ERROR: Postmaster environment variable 'PGDATA2' not set
> createdb: database creation failed
your init script is using the '-s /bin/sh' argument to 'su', which means
bash runs in compat mode (sh is a soft link to bash on linux), and does not
use .bash_profile. you need to set up a file ~postgres/.profile (along side
of .bash_profile) and put your PGDATA2 environment export in there, or
possibly source .profile from .bash_profile. restart the postmaster and it
should now work.
guys, is there a good reason why the init script has to specify a shell
explicitly? the passwd entry for postgres should be good enough it seems
like... changing the init script at install time is a bad solution because
it gets over-written on postgres upgrades from RPM. and adding a .profile
file is not exactly intuative, and the need for it is not documented
anywhere that i could find.
Glen