Steve Wampler wrote:
>
> I just upgraded from 7.0.3 to 7.1 (using the RH rpms) with no
> major problems. Nice!
>
> However, I'm getting some strange behaviour from the init
> script (/etc/rc.d/init.d/postgresql). In particular, a
> restart when the database is running fails because the
> "sleep 2" in stop() is no longer long enough (on a dual-cpu
> PIII/650 machine!). So "pidof postmaster" returns a non-null
> value and *that* results in a syntax error:
>
> Checking postgresql installation: [ OK ]
> ./postgresql: [: 18209: unary operator expected
ISTM that every occurrence of
if [ $pid ]
should be
if [ -n "$pid" ]
>
> (I think the test should become something like "if [ -n "$pid" ];..."
> instead of just "if [ $pid ]", which at least prevents the
> syntax error...)
>
> Of course, fixing the syntax error isn't the main problem, which
> is that the shutdown of the old postmaster(s) hasn't completed yet,
> resulting in a "false positive" from the pidof operation.
>
> I bumped the "sleep 2" up to "sleep 5" and the problem went away.
> Surely there's a better fix?
In the stop() function, I use:
su -l postgres -c "/usr/bin/pg_ctl -D $PGDATA -w stop"
with no sleep at all
I sent both these changes to lamar during rc4, but I got no reply. I
don't know if he got them and determined that my patches were worthless,
or if they did not reach him. In any case, those two changes work for
me. YMMV.
--
Karl