Gitweb:
http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=f5e510ffc9f...
Commit: f5e510ffc9f762093d6d83b5d5876f50b892868a
Parent: 24d751325ef921e73dc28ba64a13d581a2ea442f
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Fri Apr 8 15:16:58 2011 +0200
Committer: Ryan McCabe <rmccabe(a)redhat.com>
CommitterDate: Thu Mar 13 13:21:04 2014 -0400
postgres-8: Improve testing if postgres started succesfully
In previous versions we were not testing if postgres started succesfully. If
starting failed then we will encounter problem in first attempt to test
availability. This new feature proposed by Magnus Glatz uses pg_ctl to check
this directly.
Resolves: rhbz#663827 (part 2/2)
Acked-by: Ryan McCabe <rmccabe(a)redhat.com>
---
rgmanager/src/resources/postgres-8.sh | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/rgmanager/src/resources/postgres-8.sh
b/rgmanager/src/resources/postgres-8.sh
index 8762d36..f99e32d 100755
--- a/rgmanager/src/resources/postgres-8.sh
+++ b/rgmanager/src/resources/postgres-8.sh
@@ -33,10 +33,12 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin
. $(dirname $0)/utils/ra-skelet.sh
declare PSQL_POSTMASTER="/usr/bin/postmaster"
+declare PSQL_CTL="/usr/bin/pg_ctl"
declare PSQL_pid_file="`generate_name_for_pid_file`"
declare PSQL_conf_dir="`generate_name_for_conf_dir`"
declare PSQL_gen_config_file="$PSQL_conf_dir/postgresql.conf"
declare PSQL_kill_timeout="5"
+declare PSQL_wait_after_start="2"
verify_all()
{
@@ -165,6 +167,11 @@ start()
su - "$OCF_RESKEY_postmaster_user" -c "$PSQL_POSTMASTER -c
config_file=\"$PSQL_gen_config_file\" \
$OCF_RESKEY_postmaster_options" &> /dev/null &
+ # We need to sleep for a second to allow pg_ctl to detect that we've started.
+ sleep $PSQL_wait_after_start
+ # We need to fetch "-D /path/to/pgsql/data" from
$OCF_RESKEY_postmaster_options
+ su - "$OCF_RESKEY_postmaster_user" -c "$PSQL_CTL status
$OCF_RESKEY_postmaster_options" &> /dev/null
+
if [ $? -ne 0 ]; then
clog_service_start $CLOG_FAILED
return $OCF_ERR_GENERIC