Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7c9f295

Browse files
committed
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 anyold pidfile.
1 parentaf6e88a commit7c9f295

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

‎src/bin/pg_ctl/pg_ctl.sh

Lines changed: 13 additions & 8 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.18 2001/02/08 19:39:24 petere Exp $
11+
# $Header: /cvsroot/pgsql/src/bin/pg_ctl/Attic/pg_ctl.sh,v 1.19 2001/03/18 20:27:11 tgl Exp $
1212
#
1313
#-------------------------------------------------------------------------
1414

@@ -293,9 +293,10 @@ if [ $op = "stop" -o $op = "restart" ];then
293293
fi# stop or restart
294294

295295
if [$op="start"-o$op="restart" ];then
296+
oldpid=""
296297
if [-f$PIDFILE ];then
297-
echo"$CMDNAME:It seems anotherpostmasteris running. Trying to start postmaster anyway."1>&2
298-
pid=`sed -n 1p$PIDFILE`
298+
echo"$CMDNAME:Anotherpostmastermay be running. Trying to start postmaster anyway."1>&2
299+
oldpid=`sed -n 1p$PIDFILE`
299300
fi
300301

301302
unset logopt
@@ -330,11 +331,15 @@ if [ $op = "start" -o $op = "restart" ];then
330331

331332
eval'$po_path''$POSTOPTS'$logopt'&'
332333

333-
if [-f$PIDFILE ];then
334-
if ["`sed -n 1p$PIDFILE`"="$pid" ];then
335-
echo"$CMDNAME: cannot start postmaster"1>&2
336-
echo"Examine the log output."1>&2
337-
exit 1
334+
# if had an old lockfile, check to see if we were able to start
335+
if [-n"$oldpid" ];then
336+
sleep 1
337+
if [-f$PIDFILE ];then
338+
if ["`sed -n 1p$PIDFILE`"="$oldpid" ];then
339+
echo"$CMDNAME: cannot start postmaster"1>&2
340+
echo"Examine the log output."1>&2
341+
exit 1
342+
fi
338343
fi
339344
fi
340345

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp