mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2024-12-23 23:09:20 +01:00
Fixed PostgreSQL availability check
This commit is contained in:
parent
7436513ee1
commit
17451c107f
@ -186,7 +186,7 @@ check_db_connect_postgresql() {
|
||||
export PGOPTIONS
|
||||
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..."
|
||||
sleep $WAIT_TIMEOUT
|
||||
done
|
||||
@ -204,7 +204,7 @@ psql_query() {
|
||||
if [ -n "${DB_SERVER_ZBX_PASS}" ]; then
|
||||
export PGPASSWORD="${DB_SERVER_ZBX_PASS}"
|
||||
fi
|
||||
|
||||
|
||||
if [ -n "${DB_SERVER_SCHEMA}" ]; then
|
||||
PGOPTIONS="--search_path=${DB_SERVER_SCHEMA}"
|
||||
export PGOPTIONS
|
||||
@ -269,7 +269,7 @@ create_db_schema_postgresql() {
|
||||
|
||||
zcat /usr/share/doc/zabbix-server-postgresql/create.sql.gz | psql --quiet \
|
||||
--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 PGOPTIONS
|
||||
|
@ -186,7 +186,7 @@ check_db_connect_postgresql() {
|
||||
export PGOPTIONS
|
||||
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..."
|
||||
sleep $WAIT_TIMEOUT
|
||||
done
|
||||
@ -269,7 +269,7 @@ create_db_schema_postgresql() {
|
||||
|
||||
zcat /usr/share/doc/zabbix-server-postgresql/create.sql.gz | psql --quiet \
|
||||
--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 PGOPTIONS
|
||||
|
@ -186,7 +186,7 @@ check_db_connect_postgresql() {
|
||||
export PGOPTIONS
|
||||
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..."
|
||||
sleep $WAIT_TIMEOUT
|
||||
done
|
||||
@ -269,7 +269,7 @@ create_db_schema_postgresql() {
|
||||
|
||||
zcat /usr/share/doc/zabbix-server-postgresql/create.sql.gz | psql --quiet \
|
||||
--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 PGOPTIONS
|
||||
|
Loading…
Reference in New Issue
Block a user