Try to auto-detect PG_MAIN directory.

This commit is contained in:
Benjamin Renard 2017-08-25 16:19:15 +02:00
parent d8a4cfac51
commit 3966aac8c1

View file

@ -19,9 +19,14 @@
PG_USER=postgres
PSQL_BIN=/usr/bin/psql
PG_MAIN=/var/lib/postgresql/9.1/main
if [ -f /etc/redhat-release ]
if [ -f /etc/debian_version ]
then
PG_MAIN=/var/lib/pgsql/9.1/data
AUTO_PG_MAIN=$( ls -1d /var/lib/postgresql/9*/main 2> /dev/null|sort -n|tail -n 1 )
[ -n "$AUTO_PG_MAIN" -a -d "$AUTO_PG_MAIN" ] && PG_MAIN=$AUTO_PG_MAIN
elif [ -f /etc/redhat-release ]
then
AUTO_PG_MAIN=$( ls -1d /var/lib/pgsql/9*/data 2> /dev/null|sort -n|tail -n 1 )
[ -n "$AUTO_PG_MAIN" -a -d "$AUTO_PG_MAIN" ] && PG_MAIN=$AUTO_PG_MAIN
fi
RECOVERY_CONF_FILENAME=recovery.conf
RECOVERY_CONF=""
@ -36,7 +41,8 @@ Usage : $0 [-d] [-h] [options]
-u pg_user Specify Postgres user (Default : $PG_USER)
-b psql_bin Specify psql binary path (Default : $PSQL_BIN)
-m pg_main Specify Postgres main directory path
(Default : $PG_MAIN)
(By default, try to auto-detect it, on your system it :
$PG_MAIN)
-r recovery_conf Specify Postgres recovery configuration file path
(Default : $PG_MAIN/$RECOVERY_CONF_FILENAME)
-p pg_port Specify default Postgres master TCP port (Default : $PG_DEFAULT_PORT)