pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
PostgreSQL default data location
3+ messages / 2 participants
[nested] [flat]

* PostgreSQL default data location
@ 2005-06-09 20:53  James Herbers <james@herbers.ca>
  0 siblings, 1 reply; 3+ messages in thread

From: James Herbers @ 2005-06-09 20:53 UTC (permalink / raw)
  To: pgsql-admin

I am running Trustix 3.0 RC2 and am trying to set the default data 
location for PostgreSQL as follows:
I changed the default PostgreSQL data directory by running initdb -D 
/vol1/pgsql/data as the postgres user.
Next I edited /etc/sysconfig/postgresql to change the PGDATA variable to 
the new directory.
When I try to start postgreSQL it chokes saying the data directory 
/var/lib/posgresql/data has not been initilized, which is true but it 
should be trying to use the new data directory!
I then also tried editing /etc/sysconfig/postmaster.args to add the -D 
/vol1/pgsql/data option to it but this also did not work!
After looking at the /etc/init.d/postgresql script I put a symbolic link 
in /etc/sysconfig/postgresql.d to point to the file 
/etc/sysconfig/postgresql. Now if I use the command 'service postgrsql 
start' everything works fine...But on reboot the same problem occurs, 
postgresql tries to use the /var/lib/postgres/data directory still.
What seems weird is that the service command works (or 
'/etc/init.d/postgresql start') but if I try to run the script 
'/etc/rc3.d/S85postgresql start' it looks for the default data directory 
and chokes.
To make a long story short how do I change the default data diretory for 
PostgreSQL? What did I do wrong?

James Herbers



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: PostgreSQL default data location
@ 2005-06-10 13:48  James Herbers <james@herbers.ca>
  parent: James Herbers <james@herbers.ca>
  0 siblings, 1 reply; 3+ messages in thread

From: James Herbers @ 2005-06-10 13:48 UTC (permalink / raw)
  To: pgsql-admin

Found the problem,

It is a problem with the /etc/init.d/postgresql script.
On line 31 the script grabs the defaults from the 
/etc/sysconfig/postgresql file which is where they should be. But then 
on line 41-42  it goes to set these defaults by using the file 
/etc/sysconfig/postgresql.d/${NAME} which would be the name of the 
script running, fine if the script is /etc/init.d/postgresql. In the 
case of going to run level 3 the file name is S85postgresql (a link to 
/etc/init.d/postgresql)! Well there is no file with defaults named 
/etc/sysconfig/postgresql.d/S85postgresql !!
Lines 40- 42 of this script should match the defaults from line 31 and 
not reference the the name of the script being run. It should read:
# Override defaults from /etc/sysconfig/postgresql if file is present
[ -f /etc/sysconfig/postgresql ] && \
   . /etc/sysconfig/postgresql

NOT as it does:
# Override defaults from /etc/sysconfig/postgresql if file is present
[ -f /etc/sysconfig/postgresql.d/${NAME} ] && \
   . /etc/sysconfig/postgresql.d/${NAME}

James Herbers



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: PostgreSQL default data location
@ 2005-06-10 16:03  Tom Lane <tgl@sss.pgh.pa.us>
  parent: James Herbers <james@herbers.ca>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2005-06-10 16:03 UTC (permalink / raw)
  To: James Herbers <james@herbers.ca>; +Cc: pgsql-admin

James Herbers <james@herbers.ca> writes:
> It is a problem with the /etc/init.d/postgresql script.
> On line 31 the script grabs the defaults from the 
> /etc/sysconfig/postgresql file which is where they should be. But then 
> on line 41-42  it goes to set these defaults by using the file 
> /etc/sysconfig/postgresql.d/${NAME} which would be the name of the 
> script running, fine if the script is /etc/init.d/postgresql. In the 
> case of going to run level 3 the file name is S85postgresql (a link to 
> /etc/init.d/postgresql)! Well there is no file with defaults named 
> /etc/sysconfig/postgresql.d/S85postgresql !!

You need to have a word with your Linux distro vendor, I think.  The
init scripts shipped by PGDG and Red Hat, at least, have gotten this
right for a long time.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2005-06-10 16:03 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-06-09 20:53 PostgreSQL default data location James Herbers <james@herbers.ca>
2005-06-10 13:48 ` James Herbers <james@herbers.ca>
2005-06-10 16:03   ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox