diff --git a/check_pg_streaming_replication b/check_pg_streaming_replication index 264ec0d..e379c9a 100755 --- a/check_pg_streaming_replication +++ b/check_pg_streaming_replication @@ -7,12 +7,12 @@ # Requirement : # # 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) -# as trust (or via md5 using password specify in ~/.pgpass). +# to database with the same name (or another specified with -D) +# as trust (or via md5 using password specified in ~/.pgpass). # # 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 -# (or via md5 using password specify in ~/.pgpass). +# with the same name (or another specified with -D) as trust +# (or via md5 using password specified in ~/.pgpass). # # Author : Benjamin Renard # Date : Fri, 25 Aug 2017 15:57:57 +0200 @@ -95,7 +95,7 @@ do done # 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 [ $? -ne 0 ] && echo "UNKNOWN : Invalid Postgres user ($PG_USER)" && exit 3 @@ -184,10 +184,10 @@ then fi 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" ] 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 else debug "Master port : $M_PORT" @@ -201,7 +201,7 @@ then M_USER=$( echo "$MASTER_CONN_INFOS"|sed 's/^.*user= *\([^ ]*\) *.*$/\1/' ) if [ ! -n "$M_USER" ] then - debug "Master user not specify, use default : $PG_USER" + debug "Master user not specified, use default : $PG_USER" M_USER=$PG_USER else debug "Master user : $M_USER"