Retreive master host info in postgresql.auto.conf file on PG 12 and later
This commit is contained in:
parent
d33476ce8d
commit
ae1960d834
1 changed files with 5 additions and 3 deletions
|
@ -34,7 +34,6 @@ PG_MAIN=""
|
||||||
PG_MASTER_USER=""
|
PG_MASTER_USER=""
|
||||||
PSQL_BIN=/usr/bin/psql
|
PSQL_BIN=/usr/bin/psql
|
||||||
PG_LSCLUSTER_BIN=/usr/bin/pg_lsclusters
|
PG_LSCLUSTER_BIN=/usr/bin/pg_lsclusters
|
||||||
RECOVERY_CONF_FILENAME=recovery.conf
|
|
||||||
RECOVERY_CONF=""
|
RECOVERY_CONF=""
|
||||||
PG_DEFAULT_PORT=""
|
PG_DEFAULT_PORT=""
|
||||||
PG_DEFAULT_APP_NAME=$( hostname )
|
PG_DEFAULT_APP_NAME=$( hostname )
|
||||||
|
@ -55,7 +54,7 @@ Usage: $0 [-d] [-h] [options]
|
||||||
-m pg_main Specify Postgres main directory path (Default: try to auto-detect or use
|
-m pg_main Specify Postgres main directory path (Default: try to auto-detect or use
|
||||||
$DEFAULT_PG_MAIN)
|
$DEFAULT_PG_MAIN)
|
||||||
-r recovery_conf Specify Postgres recovery configuration file path
|
-r recovery_conf Specify Postgres recovery configuration file path
|
||||||
(Default: [PG_MAIN]/$RECOVERY_CONF_FILENAME)
|
(Default: [PG_MAIN]/recovery.conf on PG <= 11, [PG_MAIN]/postgresql.auto.conf on PG >= 12)
|
||||||
-U pg_master_user Specify Postgres user to use on master (Default: user from recovery.conf file)
|
-U pg_master_user Specify Postgres user to use on master (Default: user from recovery.conf file)
|
||||||
-p pg_port Specify default Postgres master TCP port (Default: same as local PostgreSQL
|
-p pg_port Specify default Postgres master TCP port (Default: same as local PostgreSQL
|
||||||
port if detected or use $DEFAULT_PG_PORT)
|
port if detected or use $DEFAULT_PG_PORT)
|
||||||
|
@ -180,7 +179,10 @@ id "$PG_USER" > /dev/null 2>&1
|
||||||
[ ! -d "$PG_MAIN/" ] && echo "UNKNOWN: Invalid Postgres main directory path ($PG_MAIN)" && exit 3
|
[ ! -d "$PG_MAIN/" ] && echo "UNKNOWN: Invalid Postgres main directory path ($PG_MAIN)" && exit 3
|
||||||
|
|
||||||
# Check RECOVERY_CONF
|
# Check RECOVERY_CONF
|
||||||
[ -z "$RECOVERY_CONF" ] && RECOVERY_CONF="$PG_MAIN/$RECOVERY_CONF_FILENAME"
|
if [ -z "$RECOVERY_CONF" ]; then
|
||||||
|
[ $PG_VERSION -le 11 ] && RECOVERY_CONF_FILENAME="recovery.conf" || RECOVERY_CONF_FILENAME="postgresql.auto.conf"
|
||||||
|
RECOVERY_CONF="$PG_MAIN/$RECOVERY_CONF_FILENAME"
|
||||||
|
fi
|
||||||
|
|
||||||
# Check PG_DEFAULT_PORT
|
# Check PG_DEFAULT_PORT
|
||||||
[ $( echo "$PG_DEFAULT_PORT"|grep -c -E '^[0-9]*$' ) -ne 1 ] && "UNKNOWN: Postgres default master TCP port must be an integer." && exit 3
|
[ $( echo "$PG_DEFAULT_PORT"|grep -c -E '^[0-9]*$' ) -ne 1 ] && "UNKNOWN: Postgres default master TCP port must be an integer." && exit 3
|
||||||
|
|
Loading…
Reference in a new issue