Skip to content

Commit 434dd8d

Browse files
committed
pgtools get port in different file.
1 parent ce6e6e4 commit 434dd8d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

image/postgresql/pgtools

+5-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ PGDATA=${DATA}/pg_data
2828
export PGDATA
2929
#export XDG_CONFIG_HOME=${DATA}/auto_failover
3030
#export XDG_DATA_HOME=${DATA}/auto_failover
31-
#run_port=$(cat ${XDG_CONFIG_HOME}/pg_autoctl/${PGDATA}/pg_autoctl.cfg | grep -w port | cut -d "=" -f 2 | tr -d " ")
32-
run_port=$(cat ${PGDATA}/postgresql.conf | grep -w port | grep '[0-9]' | tail -n 1 | cut -d '=' -f 2 | cut -d "#" -f 1 | tr -d " ")
31+
if [ "$PG_MODE" = monitor -o "$PG_MODE" = readwrite -o "$PG_MODE" = readonly ]; then
32+
run_port=$(cat ${XDG_CONFIG_HOME}/pg_autoctl/${PGDATA}/pg_autoctl.cfg | grep -w port | cut -d "=" -f 2 | tr -d " ")
33+
else
34+
run_port=$(cat ${PGDATA}/postgresql.conf | grep -w port | grep '[0-9]' | tail -n 1 | cut -d '=' -f 2 | cut -d "#" -f 1 | tr -d " ")
35+
fi
3336

3437
# run as postgres
3538
if [ "$(id -u)" = '0' ]; then

0 commit comments

Comments
 (0)