Skip to content

Commit 44a9639

Browse files
committed
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.
1 parent 6217a8c commit 44a9639

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/bin/pg_ctl/pg_ctl.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#
99
#
1010
# IDENTIFICATION
11-
# $Header: /cvsroot/pgsql/src/bin/pg_ctl/Attic/pg_ctl.sh,v 1.9 2000/02/07 04:31:10 ishii Exp $
11+
# $Header: /cvsroot/pgsql/src/bin/pg_ctl/Attic/pg_ctl.sh,v 1.10 2000/03/14 08:34:47 ishii Exp $
1212
#
1313
#-------------------------------------------------------------------------
1414
CMDNAME=`basename $0`
@@ -47,7 +47,7 @@ else
4747
fi
4848

4949
# Check if needed programs actually exist in path
50-
for prog in postmaster
50+
for prog in postmaster psql
5151
do
5252
if [ ! -x "$PGPATH/$prog" ]
5353
then
@@ -245,16 +245,17 @@ if [ $op = "start" -o $op = "restart" ];then
245245
$ECHO_N "Waiting for postmaster starting up.."$ECHO_C
246246
while :
247247
do
248-
if [ ! -f $PIDFILE ];then
248+
if psql -l >/dev/null 2>&1
249+
then
250+
break;
251+
else
249252
$ECHO_N "."$ECHO_C
250253
cnt=`expr $cnt + 1`
251254
if [ $cnt -gt 60 ];then
252255
$ECHO "$CMDNAME: postmaster does not start up"
253256
exit 1
254257
fi
255258
sleep 1
256-
else
257-
break
258259
fi
259260
done
260261
$ECHO "done."

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy