Bug 42217 - restart'ing the service does not work
Summary: restart'ing the service does not work
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: postgresql   
(Show other bugs)
Version: 1.0
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Trond Eivind Glomsrxd
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2001-05-24 20:57 UTC by Enrico Scholz
Modified: 2007-04-18 16:33 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-05-29 15:20:45 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Enrico Scholz 2001-05-24 20:57:54 UTC
Description of Problem:


/etc/init.d/postgresql contains two if-statements

|                ...
|                pid=`pidof postmaster`
|                if [ $pid ]  # <-----
|                then

where $pid can contain multiple pids when restart'ing the service:

--- sh -x /etc/init.d/postgresql restart ----
| ++ pidof postmaster
| + pid=26406 26353
| + '[' 26406 26353 ']'
|/etc/init.d/postgresql: [: 26406: unary operator expected

So I get error-messages.

I suggest to quote the `$pid' term.


Bug above shows only the symptoms of another bug: the `restart' command
executes `start' immediatily after `stop' without waiting for the service
to shutdown completely. There is a `sleep 2' in the stop function but it
seems not to be enough on my machine (K6/2-500).

pg_ctl knows a seperate `restart' command so I suggest to use it instead of
the `start; stop' sequence in the initscript. Alternatively the `-W' in

| su -l postgres -s /bin/sh -c "/usr/bin/pg_ctl -D $PGDATA -W stop"

could be omited if `stop' is called from `restart'

Steps to Reproduce:
1.   service postgresql start
2a. (produce some load to slow down machine)
2b. service postgresql restart

Actual Results:

Stopping postgresql service: postmaster successfully shut down

Checking postgresql installation:                                       [ 
OK  ]
/etc/init.d/postgresql: [: 27566: unary operator expected
Starting postgresql service:                                           

Additional Information:
# rpm -q postgresql initscripts

Comment 1 Trond Eivind Glomsrxd 2001-05-29 15:20:41 UTC
Fixed in postgresql-7.1.2-1, coming soon to rawhide. The SRPM is, for a limited
time, available from http://people.redhat.com/teg/pg/

Note You need to log in before you can comment on or make changes to this bug.