Description of Problem: 1. /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. 2. 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: [FAILED] Additional Information: # rpm -q postgresql initscripts postgresql-7.1.1-0.8 initscripts-5.86-1
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/