Quiet the output of wait-for-it (#5775)
When wait-for-it is trying to connect and failing, bash emits errors on stderr. This captures those errors and sends them to /dev/null. This also replaces an internal wait_tcp_port function inside entrypoint.sh with a call to wait-for-it.sh.
This commit is contained in:
parent
44d9d50a92
commit
3d0a818bef
|
@ -10,29 +10,9 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
rm -f /var/run/rsyslogd.pid
|
rm -f /var/run/rsyslogd.pid
|
||||||
service rsyslog start
|
service rsyslog start
|
||||||
|
|
||||||
wait_tcp_port() {
|
|
||||||
local host="$1" port="$2"
|
|
||||||
|
|
||||||
# see http://tldp.org/LDP/abs/html/devref1.html for description of this syntax.
|
|
||||||
local max_tries="120"
|
|
||||||
for n in `seq 1 $max_tries` ; do
|
|
||||||
if exec 6<>/dev/tcp/$host/$port; then
|
|
||||||
break
|
|
||||||
else
|
|
||||||
echo "$(date) - still trying to connect to $host:$port"
|
|
||||||
sleep 1
|
|
||||||
fi
|
|
||||||
if [ "$n" -eq "$max_tries" ]; then
|
|
||||||
echo "unable to connect"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
exec 6>&-
|
|
||||||
echo "Connected to $host:$port"
|
|
||||||
}
|
|
||||||
# make sure we can reach the mysqldb and Redis cluster is done being created.
|
# make sure we can reach the mysqldb and Redis cluster is done being created.
|
||||||
wait_tcp_port boulder-mysql 3306
|
./test/wait-for-it.sh boulder-mysql 3306
|
||||||
wait_tcp_port 10.33.33.10 4218
|
./test/wait-for-it.sh 10.33.33.10 4218
|
||||||
|
|
||||||
# create the database
|
# create the database
|
||||||
MYSQL_CONTAINER=1 $DIR/create_db.sh
|
MYSQL_CONTAINER=1 $DIR/create_db.sh
|
||||||
|
|
|
@ -8,7 +8,7 @@ wait_tcp_port() {
|
||||||
# see http://tldp.org/LDP/abs/html/devref1.html for description of this syntax.
|
# see http://tldp.org/LDP/abs/html/devref1.html for description of this syntax.
|
||||||
local max_tries="40"
|
local max_tries="40"
|
||||||
for n in `seq 1 "${max_tries}"` ; do
|
for n in `seq 1 "${max_tries}"` ; do
|
||||||
if exec 6<>/dev/tcp/"${host}"/"${port}"; then
|
if { exec 6<>/dev/tcp/"${host}"/"${port}" ; } 2>/dev/null ; then
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
echo "$(date) - still trying to connect to ${host}:${port}"
|
echo "$(date) - still trying to connect to ${host}:${port}"
|
||||||
|
|
Loading…
Reference in New Issue