diff options
author | Morgan Richomme <morgan.richomme@orange.com> | 2020-12-10 21:46:19 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-12-10 21:46:19 +0000 |
commit | 1d09e1ddb6eaf97c85dd714095f39fcc20839b9a (patch) | |
tree | ab23217c089dce320d13d8484149ce6a06813552 | |
parent | e548f1535da4c8973ea811dd34a4cf06bd022890 (diff) | |
parent | 2265e817b8229be6edcbb0e2df228cd1f6728457 (diff) |
Merge "remove bash to ash"
-rw-r--r-- | scripts/policy/docker-compose-all.yml | 6 | ||||
-rwxr-xr-x | scripts/policy/wait_for_port.sh | 19 |
2 files changed, 12 insertions, 13 deletions
diff --git a/scripts/policy/docker-compose-all.yml b/scripts/policy/docker-compose-all.yml index 7b1f00a0..00f76350 100644 --- a/scripts/policy/docker-compose-all.yml +++ b/scripts/policy/docker-compose-all.yml @@ -51,7 +51,7 @@ services: - ./wait_for_port.sh:/opt/app/policy/api/bin/wait_for_port.sh:ro entrypoint: ./wait_for_port.sh command: [ - '-c', 'bash ./policy-api.sh', + '-c', './policy-api.sh', 'mariadb', '3306' ] pap: @@ -69,7 +69,7 @@ services: - ./wait_for_port.sh:/opt/app/policy/pap/bin/wait_for_port.sh:ro entrypoint: ./wait_for_port.sh command: [ - '-c', 'bash ./policy-pap.sh', + '-c', './policy-pap.sh', 'mariadb', '3306', 'policy.api.simpledemo.onap.org', '3905', 'api', '6969' @@ -89,7 +89,7 @@ services: - ./wait_for_port.sh:/opt/app/policy/pdpx/bin/wait_for_port.sh:ro entrypoint: ./wait_for_port.sh command: [ - '-c', 'bash ./policy-pdpx.sh', + '-c', './policy-pdpx.sh', 'mariadb', '3306', 'policy.api.simpledemo.onap.org', '3905', 'pap', '6969' diff --git a/scripts/policy/wait_for_port.sh b/scripts/policy/wait_for_port.sh index c50cd970..1d2f5155 100755 --- a/scripts/policy/wait_for_port.sh +++ b/scripts/policy/wait_for_port.sh @@ -1,35 +1,34 @@ -#!/bin/bash +#!/bin/sh tmout=120 cmd= - while getopts c:t: opt; do case "$opt" in c) cmd="$OPTARG" ;; t) tmout="$OPTARG" ;; esac done -let nargs=$OPTIND-1 +nargs=$(expr $OPTIND - 1) shift $nargs -let even_args=$#%2 -if [[ $# -lt 2 || $even_args -ne 0 ]]; then - echo "args: [-t timeout] [-c command] hostname1 port1 hostname2 port2 ..." >&2 - exit 1 +even_args=$(expr $# % 2) +if [ $# -lt 2 -o $even_args -ne 0 ]; then + echo "args: [-t timeout] [-c command] hostname1 port1 hostname2 port2 ..." >&2 + exit 1 fi -while [[ $# -ge 2 ]]; do +while [ $# -ge 2 ]; do export host=$1 export port=$2 shift shift echo "Waiting for $host port $port..." - timeout $tmout bash -c 'until nc -vz "$host" "$port"; do echo -n "."; + timeout $tmout sh -c 'until nc -vz "$host" "$port"; do echo -n "."; sleep 1; done' rc=$? - if [[ $rc != 0 ]]; then + if [ $rc != 0 ]; then echo "$host port $port cannot be reached" exit $rc fi |