From c29d475794226ce38de021d72430ccde75a38d2a Mon Sep 17 00:00:00 2001 From: Alfred Landrum Date: Thu, 27 Oct 2022 11:22:09 -0700 Subject: [PATCH] use socat instead of nc (#476) Signed-off-by: Alfred Landrum Signed-off-by: Alfred Landrum Co-authored-by: anishakj <43978302+anishakj@users.noreply.github.com> --- docker/Dockerfile | 2 +- docker/bin/zookeeperLive.sh | 2 +- docker/bin/zookeeperMetrics.sh | 2 +- docker/bin/zookeeperReady.sh | 2 +- docker/bin/zookeeperTeardown.sh | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index baaf42b3c..1ef1fbdc7 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -21,4 +21,4 @@ RUN chmod +x /usr/local/bin/* COPY --from=0 /zu/build/libs/zu.jar /opt/libs/ RUN apt-get -q update && \ - apt-get install -y dnsutils curl procps + apt-get install -y dnsutils curl procps socat diff --git a/docker/bin/zookeeperLive.sh b/docker/bin/zookeeperLive.sh index 9291c0e5f..9e6d6e02f 100755 --- a/docker/bin/zookeeperLive.sh +++ b/docker/bin/zookeeperLive.sh @@ -13,7 +13,7 @@ set -ex source /conf/env.sh -OK=$(echo ruok | nc 127.0.0.1 $CLIENT_PORT) +OK=$(echo ruok | socat stdio tcp:localhost:$CLIENT_PORT) # Check to see if zookeeper service answers if [[ "$OK" == "imok" ]]; then diff --git a/docker/bin/zookeeperMetrics.sh b/docker/bin/zookeeperMetrics.sh index a5225ba83..bd0c875e3 100755 --- a/docker/bin/zookeeperMetrics.sh +++ b/docker/bin/zookeeperMetrics.sh @@ -13,4 +13,4 @@ set -ex source /conf/env.sh -echo mntr | nc localhost $CLIENT_PORT >& 1 +echo mntr | socat stdio tcp:localhost:$CLIENT_PORT >& 1 diff --git a/docker/bin/zookeeperReady.sh b/docker/bin/zookeeperReady.sh index e31469e6a..e9583e5b6 100755 --- a/docker/bin/zookeeperReady.sh +++ b/docker/bin/zookeeperReady.sh @@ -20,7 +20,7 @@ MYID_FILE=$DATA_DIR/myid LOG4J_CONF=/conf/log4j-quiet.properties STATIC_CONFIG=/data/conf/zoo.cfg -OK=$(echo ruok | nc 127.0.0.1 $CLIENT_PORT) +OK=$(echo ruok | socat stdio tcp:localhost:$CLIENT_PORT) # Check to see if zookeeper service answers if [[ "$OK" == "imok" ]]; then diff --git a/docker/bin/zookeeperTeardown.sh b/docker/bin/zookeeperTeardown.sh index 85af30fbb..da361b8db 100755 --- a/docker/bin/zookeeperTeardown.sh +++ b/docker/bin/zookeeperTeardown.sh @@ -21,7 +21,7 @@ LOG4J_CONF=/conf/log4j-quiet.properties # Wait for client connections to drain. Kubernetes will wait until the confiugred # "terminationGracePeriodSeconds" before focibly killing the container for (( i = 0; i < 6; i++ )); do - CONN_COUNT=`echo cons | nc localhost 2181 | grep -v "^$" |grep -v "/127.0.0.1:" | wc -l` + CONN_COUNT=`echo cons | socat stdio tcp:localhost:$CLIENT_PORT | grep -v "^$" |grep -v "/127.0.0.1:" | wc -l` if [[ "$CONN_COUNT" -gt 0 ]]; then echo "$CONN_COUNT non-local connections still connected." sleep 5