Skip to content
Snippets Groups Projects
Commit 3ab88c2a authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

Merge branch 'update-docs' into 'master'

OP#7270 Icinga: Check EOL postgres: postgres 15

See merge request !273
parents 625c25b8 ca2e27e1
No related branches found
No related tags found
1 merge request!273OP#7270 Icinga: Check EOL postgres: postgres 15
......@@ -5,31 +5,31 @@
# detect version of PostgreSQL
#
# ----------------------------------------------------------------------------
# 2020-02-25 v1.0 <axel.hahn@iml.unibe.ch> initial version
# 2021-03-26 v1.1 <axel.hahn@iml.unibe.ch> add locations if postgres is not in PATH
# 2020-02-25 v1.0 <axel.hahn@iml.unibe.ch> initial version
# 2021-03-26 v1.1 <axel.hahn@iml.unibe.ch> add locations if postgres is not in PATH
# 2021-08-23 v1.1 <martin.gasser@iml.unibe.ch> added location for v11
# 2022-04-07 v1.2 <martin.gasser@iml.unibe.ch> added location for v13
# 2024-06-11 v1.3 <axel.hahn@iml.unibe.ch> handle placeholders in otherplaces for latest version
# ----------------------------------------------------------------------------
#
# WORKAROUND: add additional locations in $PATH
#
#otherlocations="/usr/pgsql-10/bin/ /some/other/postgres/location/bin/"
otherlocations="/usr/pgsql-10/bin/ /usr/lib/postgresql/11/bin /usr/lib/postgresql/13/bin"
# other locations. When using placeholders (like *) then it looks to the
# highest number
otherlocations="
/usr/pgsql-10/bin
/usr/lib/postgresql/*/bin
"
POSTGRES=$( which postgres 2>/dev/null )
test -z "$POSTGRES" &&
for mypath in ${otherlocations}
do
test -x "$mypath/postgres" && POSTGRES="$mypath/postgres"
do
if latest=$(ls -1dtr "${mypath}" 2>/dev/null | sort -n | tail -1 ); then
test -x "$latest/postgres" && POSTGRES="$latest/postgres"
fi
done
#
# ----- example output
# postgres --version
# postgres (PostgreSQL) 9.2.24
# postgres (PostgreSQL) 15.6 (Debian 15.6-0+deb12u1)
$POSTGRES --version | cut -f 3 -d " " | cut -f 1,2 -d '.'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment