Use "hostname --ip-address" consistently

This commit is contained in:
Tianon Gravi 2016-06-13 14:47:52 -07:00
parent 47c0ddbc33
commit 7195166c70
4 changed files with 10 additions and 6 deletions

View File

@ -1,7 +1,9 @@
#!/bin/bash
set -eo pipefail
if mongo --quiet localhost --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)'; then
host="$(hostname --ip-address || echo '127.0.0.1')"
if mongo --quiet "$host/test" --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)'; then
exit 0
fi

View File

@ -7,13 +7,13 @@ if [ "$MYSQL_RANDOM_ROOT_PASSWORD" ] && [ -z "$MYSQL_USER" ] && [ -z "$MYSQL_PAS
exit 0
fi
host="$(hostname --ip-address || echo '127.0.0.1')"
user="${MYSQL_USER:-root}"
export MYSQL_PWD="${MYSQL_PASSWORD:-$MYSQL_ROOT_PASSWORD}"
args=(
# force mysql to not use the local "mysqld.sock" (test "external" connectibility)
-h"$(hostname --ip-address || echo '127.0.0.1')"
-h"$host"
-u"$user"
--silent
)

View File

@ -1,13 +1,13 @@
#!/bin/bash
set -eo pipefail
host="$(hostname --ip-address || echo '127.0.0.1')"
user="${POSTGRES_USER:-postgres}"
export PGPASSWORD="${POSTGRES_PASSWORD:-}"
args=(
# force postgres to not use the local unix socket (test "external" connectibility)
--host "$(hostname --ip-address || echo '127.0.0.1')"
--host "$host"
--username "$user"
--quiet --no-align --tuples-only
)

View File

@ -1,7 +1,9 @@
#!/bin/bash
set -eo pipefail
if ping="$(redis-cli ping)" && [ "$ping" = 'PONG' ]; then
host="$(hostname --ip-address || echo '127.0.0.1')"
if ping="$(redis-cli -h "$host" ping)" && [ "$ping" = 'PONG' ]; then
exit 0
fi