Re: [Cooker] postgresql initscript bug

2003-01-29 Thread Guillaume Rousse
Le Mercredi 29 Janvier 2003 08:12, James Gregory a écrit :
 On Wed, 2003-01-29 at 18:04, James Gregory wrote:
  I suspect the culprit is this line:
 
  su -l postgres -s /bin/sh -c /usr/bin/pg_ctl  -D $PGDATA -p
  /usr/bin/postmaster -o '-p ${PGPORT}' start   /dev/null 21 
  /dev/null

 ... indeed it was. I'm now using this:

 su -l postgres -s /bin/sh -c /usr/bin/pg_ctl  -D $PGDATA -p
 /usr/bin/postmaster -o '-p ${PGPORT} ${PGOPTS}' start   /dev/null 21
  /dev/null
Don't change the initscript. Use /var/log/pgsql/data/postgres.conf instead.
-- 
If such a program has not crashed yet, it is waiting for a critical moment 
before it crashes. 
-- Murphy's Computer Laws n°6





Re: [Cooker] postgresql initscript bug

2003-01-29 Thread James Gregory
On Wed, 2003-01-29 at 20:36, Guillaume Rousse wrote:
 Le Mercredi 29 Janvier 2003 08:12, James Gregory a écrit :
  On Wed, 2003-01-29 at 18:04, James Gregory wrote:
   I suspect the culprit is this line:
  
   su -l postgres -s /bin/sh -c /usr/bin/pg_ctl  -D $PGDATA -p
   /usr/bin/postmaster -o '-p ${PGPORT}' start   /dev/null 21 
   /dev/null
 
  ... indeed it was. I'm now using this:
 
  su -l postgres -s /bin/sh -c /usr/bin/pg_ctl  -D $PGDATA -p
  /usr/bin/postmaster -o '-p ${PGPORT} ${PGOPTS}' start   /dev/null 21
   /dev/null
 Don't change the initscript. Use /var/log/pgsql/data/postgres.conf instead.

I don't actually have a /var/log/pgsql, I went hunting for one when my
server didn't come up. If you're referring to
/var/lib/pgsql/data/postgres.conf, yes, you're quite right, that's where
the setting goes, as per
/usr/share/doc/postgresql-7.3.1/README.rpm-dist.

So, I want to know - what purpose does the line 

export PGOPTS

have in /etc/rc.d/init.d/postgresql have if not to specify such options?
If you search for that string, you'll notice it's only used once, on
that line. The variable is never referred to again.

My reading of the file is that it is intended to read the options in
from /etc/sysconfig/pgsql/postgresql and apply them if they are present.
This is all well and good, except that unlike PGDATA and PGPORT, PGOPTS
is never used.

I think that either my modification (well, a variation which tests
whether PGOPTS is set) should be applied or the section that exports
PGOPTS should be removed and a note placed there that all configuration
(including -i) should be done in the relevant configuration file (and
name said configuration file)

There should be *one* way to configure these things, and it should be
easy.

Thanks,

James.






Re: [Cooker] postgresql initscript bug

2003-01-29 Thread Buchan Milne
James Gregory wrote:
 On Wed, 2003-01-29 at 20:36, Guillaume Rousse wrote:
 
Le Mercredi 29 Janvier 2003 08:12, James Gregory a écrit :

On Wed, 2003-01-29 at 18:04, James Gregory wrote:

I suspect the culprit is this line:

su -l postgres -s /bin/sh -c /usr/bin/pg_ctl  -D $PGDATA -p
/usr/bin/postmaster -o '-p ${PGPORT}' start   /dev/null 21 
/dev/null

... indeed it was. I'm now using this:

su -l postgres -s /bin/sh -c /usr/bin/pg_ctl  -D $PGDATA -p
/usr/bin/postmaster -o '-p ${PGPORT} ${PGOPTS}' start   /dev/null 21
 /dev/null

[...]

 I think that either my modification (well, a variation which tests
 whether PGOPTS is set) should be applied or the section that exports
 PGOPTS should be removed and a note placed there that all configuration
 (including -i) should be done in the relevant configuration file (and
 name said configuration file)
 
 There should be *one* way to configure these things, and it should be
 easy.
 

Haven't tried this, and am not sure how the args should be passed (ie
should -o be passed if PGOPTS isn't set but PGPORT it?) but it would be
something like this:

su -l postgres -s /bin/sh -c /usr/bin/pg_ctl  -D $PGDATA -p \
/usr/bin/postmaster ${PGOPTS:+'-o'} '-p ${PGPORT:+'-p '}${PGPORT} \
 ${PGOPTS}' start   \
/dev/null 21  /dev/null

(I think, but the script may have been mangled by the mail before I
looked at it ..).

(
[bgmilne@bgmilne bgmilne]$ unset MYVAR
[bgmilne@bgmilne bgmilne]$ echo ${MYVAR:+'-o '}${MYVAR}

[bgmilne@bgmilne bgmilne]$ MYVAR=yo
[bgmilne@bgmilne bgmilne]$ echo ${MYVAR:+'-o '}${MYVAR}
-o yo
[bgmilne@bgmilne bgmilne]$
)

Buchan

-- 
|--Another happy Mandrake Club member--|
Buchan MilneMechanical Engineer, Network Manager
Cellphone * Work+27 82 472 2231 * +27 21 8828820x121
Stellenbosch Automotive Engineering http://www.cae.co.za
GPG Key   http://ranger.dnsalias.com/bgmilne.asc
1024D/60D204A7 2919 E232 5610 A038 87B1 72D6 AC92 BA50 60D2 04A7





Re: [Cooker] postgresql initscript bug

2003-01-29 Thread James Gregory
On Thu, 2003-01-30 at 00:18, Buchan Milne wrote:
 James Gregory wrote:
  On Wed, 2003-01-29 at 20:36, Guillaume Rousse wrote:
  
 Le Mercredi 29 Janvier 2003 08:12, James Gregory a écrit :
 
 On Wed, 2003-01-29 at 18:04, James Gregory wrote:
 
 I suspect the culprit is this line:
 
 su -l postgres -s /bin/sh -c /usr/bin/pg_ctl  -D $PGDATA -p
 /usr/bin/postmaster -o '-p ${PGPORT}' start   /dev/null 21 
 /dev/null
 
 ... indeed it was. I'm now using this:
 
 su -l postgres -s /bin/sh -c /usr/bin/pg_ctl  -D $PGDATA -p
 /usr/bin/postmaster -o '-p ${PGPORT} ${PGOPTS}' start   /dev/null 21
  /dev/null
 
 [...]
 
  I think that either my modification (well, a variation which tests
  whether PGOPTS is set) should be applied or the section that exports
  PGOPTS should be removed and a note placed there that all configuration
  (including -i) should be done in the relevant configuration file (and
  name said configuration file)
  
  There should be *one* way to configure these things, and it should be
  easy.
  
 
 Haven't tried this, and am not sure how the args should be passed (ie
 should -o be passed if PGOPTS isn't set but PGPORT it?) but it would be
 something like this:

[snip]

yes, that was in fact what I had in mind. However it occurs to me that
it's unnecessary; the -o will be there anyway to set the port. if PGOPTS
isn't set then it will just append the empty string = no harm done.

ie, PGPORT seems to be set regardless. I haven't looked into where it is
set, but the existing script works on the assumption that it is, so we
should too.

I was going to suggest that PGOPTS be removed entirely, since it's now
in the GUC. However, it may remain convenient for users to pass misc
options to the postmaster for some time yet...

That said It should probably be phased out eventually -- should we just
remove the PGOPTS line and ignore the whole debacle? (and put the
comment pointing users to the config file in its place)

James.






Re: [Cooker] postgresql initscript bug

2003-01-28 Thread James Gregory
On Wed, 2003-01-29 at 18:04, James Gregory wrote:

 I suspect the culprit is this line:
 
 su -l postgres -s /bin/sh -c /usr/bin/pg_ctl  -D $PGDATA -p
 /usr/bin/postmaster -o '-p ${PGPORT}' start   /dev/null 21 
 /dev/null

... indeed it was. I'm now using this:

su -l postgres -s /bin/sh -c /usr/bin/pg_ctl  -D $PGDATA -p
/usr/bin/postmaster -o '-p ${PGPORT} ${PGOPTS}' start   /dev/null 21
 /dev/null

which works.

HTH

James.






[Cooker] postgresql initscript bug

2003-01-28 Thread James Gregory
Just upgraded postgres to:

postgresql-test-7.3.1-6mdk
postgresql-jdbc-7.3.1-6mdk
postgresql-python-7.3.1-6mdk
postgresql-tcl-7.3.1-6mdk
postgresql-server-7.3.1-6mdk
postgresql-contrib-7.3.1-6mdk
postgresql-7.3.1-6mdk
postgresql-devel-7.3.1-6mdk

got it migrated and then attempted to add the -i option in the
/etc/sysconfig/pgsql/postgresql file as instructed to allow network
connections. It looks like the PGOPTS variable is ignored in the
initscript. At any rate I am unable to make connections to 127.0.0.1
after setting the option in this file.

I suspect the culprit is this line:

su -l postgres -s /bin/sh -c /usr/bin/pg_ctl  -D $PGDATA -p
/usr/bin/postmaster -o '-p ${PGPORT}' start   /dev/null 21 
/dev/null

There should be a -o $PGOPTS in there somewhere -- unfortunately my
attempts to get it to work have failed thus far.

James.