aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-03-18 20:27:11 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-03-18 20:27:11 +0000
commit7c9f29546c13375e786d60d52873c93f0e8ace2b (patch)
treefd35c41eb0c438ba3e1e4eb8e1206d79a8ebc8af
parentaf6e88a9cfefcb1549a61ed7642c9837599fd0a7 (diff)
downloadpostgresql-7c9f29546c13375e786d60d52873c93f0e8ace2b.tar.gz
postgresql-7c9f29546c13375e786d60d52873c93f0e8ace2b.zip
Give postmaster enough time to update the pidfile before checking to
see if it's been updated. Skip the whole mess if we didn't see any old pidfile.
-rwxr-xr-xsrc/bin/pg_ctl/pg_ctl.sh21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/bin/pg_ctl/pg_ctl.sh b/src/bin/pg_ctl/pg_ctl.sh
index 6d575c0d64f..dc3a6282521 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.18 2001/02/08 19:39:24 petere Exp $
+# $Header: /cvsroot/pgsql/src/bin/pg_ctl/Attic/pg_ctl.sh,v 1.19 2001/03/18 20:27:11 tgl Exp $
#
#-------------------------------------------------------------------------
@@ -293,9 +293,10 @@ if [ $op = "stop" -o $op = "restart" ];then
fi # stop or restart
if [ $op = "start" -o $op = "restart" ];then
+ oldpid=""
if [ -f $PIDFILE ];then
- echo "$CMDNAME: It seems another postmaster is running. Trying to start postmaster anyway." 1>&2
- pid=`sed -n 1p $PIDFILE`
+ echo "$CMDNAME: Another postmaster may be running. Trying to start postmaster anyway." 1>&2
+ oldpid=`sed -n 1p $PIDFILE`
fi
unset logopt
@@ -330,11 +331,15 @@ if [ $op = "start" -o $op = "restart" ];then
eval '$po_path' '$POSTOPTS' $logopt '&'
- if [ -f $PIDFILE ];then
- if [ "`sed -n 1p $PIDFILE`" = "$pid" ];then
- echo "$CMDNAME: cannot start postmaster" 1>&2
- echo "Examine the log output." 1>&2
- exit 1
+ # if had an old lockfile, check to see if we were able to start
+ if [ -n "$oldpid" ];then
+ sleep 1
+ if [ -f $PIDFILE ];then
+ if [ "`sed -n 1p $PIDFILE`" = "$oldpid" ];then
+ echo "$CMDNAME: cannot start postmaster" 1>&2
+ echo "Examine the log output." 1>&2
+ exit 1
+ fi
fi
fi