This commit is contained in:
Benjamin Renard 2019-03-15 16:23:37 +01:00
parent 690811ccfb
commit 40ecc78570

View file

@ -7,12 +7,12 @@
# Requirement : # Requirement :
# #
# On master node : Slaves must be able to connect with user from recovery.conf # On master node : Slaves must be able to connect with user from recovery.conf
# to database with the same name (or another specify with -D) # to database with the same name (or another specified with -D)
# as trust (or via md5 using password specify in ~/.pgpass). # as trust (or via md5 using password specified in ~/.pgpass).
# #
# On standby node : PG_USER must be able to connect localy on the database # On standby node : PG_USER must be able to connect localy on the database
# with the same name (or another specify with -D) as trust # with the same name (or another specified with -D) as trust
# (or via md5 using password specify in ~/.pgpass). # (or via md5 using password specified in ~/.pgpass).
# #
# Author : Benjamin Renard <brenard@easter-eggs.com> # Author : Benjamin Renard <brenard@easter-eggs.com>
# Date : Fri, 25 Aug 2017 15:57:57 +0200 # Date : Fri, 25 Aug 2017 15:57:57 +0200
@ -95,7 +95,7 @@ do
done done
# Check PG_USER # Check PG_USER
[ -z "$PG_USER" ] && echo "UNKNOWN : Postgres user not specify" && exit 3 [ -z "$PG_USER" ] && echo "UNKNOWN : Postgres user not specified" && exit 3
id "$PG_USER" > /dev/null 2>&1 id "$PG_USER" > /dev/null 2>&1
[ $? -ne 0 ] && echo "UNKNOWN : Invalid Postgres user ($PG_USER)" && exit 3 [ $? -ne 0 ] && echo "UNKNOWN : Invalid Postgres user ($PG_USER)" && exit 3
@ -184,10 +184,10 @@ then
fi fi
debug "Master host : $M_HOST" debug "Master host : $M_HOST"
M_PORT=$( echo "$MASTER_CONN_INFOS"|sed 's/^.*port= *\([^ ]*\) *.*$/\1/' ) M_PORT=$( echo "$MASTER_CONN_INFOS"| grep 'port=' | sed 's/^.*port= *\([0-9a-zA-Z.-]\+\) *.*$/\1/' )
if [ ! -n "$M_PORT" ] if [ ! -n "$M_PORT" ]
then then
debug "Master port not specify, use default : $PG_DEFAULT_PORT" debug "Master port not specified, use default : $PG_DEFAULT_PORT"
M_PORT=$PG_DEFAULT_PORT M_PORT=$PG_DEFAULT_PORT
else else
debug "Master port : $M_PORT" debug "Master port : $M_PORT"
@ -201,7 +201,7 @@ then
M_USER=$( echo "$MASTER_CONN_INFOS"|sed 's/^.*user= *\([^ ]*\) *.*$/\1/' ) M_USER=$( echo "$MASTER_CONN_INFOS"|sed 's/^.*user= *\([^ ]*\) *.*$/\1/' )
if [ ! -n "$M_USER" ] if [ ! -n "$M_USER" ]
then then
debug "Master user not specify, use default : $PG_USER" debug "Master user not specified, use default : $PG_USER"
M_USER=$PG_USER M_USER=$PG_USER
else else
debug "Master user : $M_USER" debug "Master user : $M_USER"