* debian/pg_createconfig_patroni: Set default port if no clusters exist yet.
This commit is contained in:
parent
9c475d93c7
commit
e22dafae50
4
debian/pg_createconfig_patroni
vendored
4
debian/pg_createconfig_patroni
vendored
|
@ -33,6 +33,10 @@ fi
|
|||
if [ -z "$PORT" ]; then
|
||||
# try to guess next free port
|
||||
PORT=$(($(pg_lsclusters | awk '{print $3}' | grep -v Port | sort -n | tail -1) + 1))
|
||||
if [ "$PORT" -eq 1 ]; then
|
||||
# No cluster exists yet, use default port
|
||||
PORT=5432
|
||||
fi
|
||||
else
|
||||
# validate specified port
|
||||
pg_lsclusters | awk '{print $3}' | grep -q $PORT && echo "Port $PORT already in use" && exit 1
|
||||
|
|
Loading…
Reference in a new issue