summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatsuo Ishii2000-03-14 08:34:47 +0000
committerTatsuo Ishii2000-03-14 08:34:47 +0000
commit44a9639123ef9d75b9dc862f843689311c496903 (patch)
tree9e09933c8846fb4c03b2fd035af9ae9718f5a475
parent6217a8c7ba008a796ff42fa9eba614a2fa0ba1cf (diff)
Detect postmaster being ready by calling psql -l rathern than
checking postmaster.pid. It's not enough to check the existence of postmaster.pid since DB recovery might be running.
-rwxr-xr-xsrc/bin/pg_ctl/pg_ctl.sh11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/bin/pg_ctl/pg_ctl.sh b/src/bin/pg_ctl/pg_ctl.sh
index 772b275fd9a..7cf1aa4702a 100755
--- a/src/bin/pg_ctl/pg_ctl.sh
+++ b/src/bin/pg_ctl/pg_ctl.sh
@@ -8,7 +8,7 @@
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/pg_ctl/Attic/pg_ctl.sh,v 1.9 2000/02/07 04:31:10 ishii Exp $
+# $Header: /cvsroot/pgsql/src/bin/pg_ctl/Attic/pg_ctl.sh,v 1.10 2000/03/14 08:34:47 ishii Exp $
#
#-------------------------------------------------------------------------
CMDNAME=`basename $0`
@@ -47,7 +47,7 @@ else
fi
# Check if needed programs actually exist in path
-for prog in postmaster
+for prog in postmaster psql
do
if [ ! -x "$PGPATH/$prog" ]
then
@@ -245,7 +245,10 @@ if [ $op = "start" -o $op = "restart" ];then
$ECHO_N "Waiting for postmaster starting up.."$ECHO_C
while :
do
- if [ ! -f $PIDFILE ];then
+ if psql -l >/dev/null 2>&1
+ then
+ break;
+ else
$ECHO_N "."$ECHO_C
cnt=`expr $cnt + 1`
if [ $cnt -gt 60 ];then
@@ -253,8 +256,6 @@ if [ $op = "start" -o $op = "restart" ];then
exit 1
fi
sleep 1
- else
- break
fi
done
$ECHO "done."