mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2025-06-19 17:38:43 +02:00
Fixed PostgreSQL availability check
This commit is contained in:
parent
7436513ee1
commit
17451c107f
@ -186,7 +186,7 @@ check_db_connect_postgresql() {
|
|||||||
export PGOPTIONS
|
export PGOPTIONS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --list --quiet 2>/dev/null)" ]; do
|
while [ ! "$(pg_isready --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --dbname ${DB_SERVER_DBNAME} --quiet 2>/dev/null && echo $?)" ]; do
|
||||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||||
sleep $WAIT_TIMEOUT
|
sleep $WAIT_TIMEOUT
|
||||||
done
|
done
|
||||||
@ -204,7 +204,7 @@ psql_query() {
|
|||||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||||
export PGOPTIONS
|
export PGOPTIONS
|
||||||
@ -269,7 +269,7 @@ create_db_schema_postgresql() {
|
|||||||
|
|
||||||
zcat /usr/share/doc/zabbix-server-postgresql/create.sql.gz | psql --quiet \
|
zcat /usr/share/doc/zabbix-server-postgresql/create.sql.gz | psql --quiet \
|
||||||
--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} \
|
--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} \
|
||||||
--username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} 1>/dev/null
|
--username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} 1>/dev/null || exit 1
|
||||||
|
|
||||||
unset PGPASSWORD
|
unset PGPASSWORD
|
||||||
unset PGOPTIONS
|
unset PGOPTIONS
|
||||||
|
@ -186,7 +186,7 @@ check_db_connect_postgresql() {
|
|||||||
export PGOPTIONS
|
export PGOPTIONS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --list --quiet 2>/dev/null)" ]; do
|
while [ ! "$(pg_isready --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --dbname ${DB_SERVER_DBNAME} --quiet 2>/dev/null && echo $?)" ]; do
|
||||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||||
sleep $WAIT_TIMEOUT
|
sleep $WAIT_TIMEOUT
|
||||||
done
|
done
|
||||||
@ -269,7 +269,7 @@ create_db_schema_postgresql() {
|
|||||||
|
|
||||||
zcat /usr/share/doc/zabbix-server-postgresql/create.sql.gz | psql --quiet \
|
zcat /usr/share/doc/zabbix-server-postgresql/create.sql.gz | psql --quiet \
|
||||||
--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} \
|
--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} \
|
||||||
--username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} 1>/dev/null
|
--username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} 1>/dev/null || exit 1
|
||||||
|
|
||||||
unset PGPASSWORD
|
unset PGPASSWORD
|
||||||
unset PGOPTIONS
|
unset PGOPTIONS
|
||||||
|
@ -186,7 +186,7 @@ check_db_connect_postgresql() {
|
|||||||
export PGOPTIONS
|
export PGOPTIONS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --list --quiet 2>/dev/null)" ]; do
|
while [ ! "$(pg_isready --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --dbname ${DB_SERVER_DBNAME} --quiet 2>/dev/null && echo $?)" ]; do
|
||||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||||
sleep $WAIT_TIMEOUT
|
sleep $WAIT_TIMEOUT
|
||||||
done
|
done
|
||||||
@ -269,7 +269,7 @@ create_db_schema_postgresql() {
|
|||||||
|
|
||||||
zcat /usr/share/doc/zabbix-server-postgresql/create.sql.gz | psql --quiet \
|
zcat /usr/share/doc/zabbix-server-postgresql/create.sql.gz | psql --quiet \
|
||||||
--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} \
|
--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} \
|
||||||
--username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} 1>/dev/null
|
--username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} 1>/dev/null || exit 1
|
||||||
|
|
||||||
unset PGPASSWORD
|
unset PGPASSWORD
|
||||||
unset PGOPTIONS
|
unset PGOPTIONS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user