diff options
author | 2021-03-08 21:53:02 +0530 | |
---|---|---|
committer | 2021-03-08 18:15:02 +0000 | |
commit | 0434bcbb88ec0fdad1074e8fd588fe000d3974a5 (patch) | |
tree | aa4b6fdf5087eaa4ae7fade3fcdfb295306f12d1 /scripts/wait-for.sh | |
parent | 02f06213855c9e7cf1d5c7f3eea1838b2093f46c (diff) |
so-nssmf-adapter build failed issues
Issue-ID: SO-3575
Signed-off-by: mukesh.paliwal <mukesh.paliwal1@huawei.com>
Change-Id: I58fde2cd2a1bf65702e34eeeeab0d967c10f23c8
Diffstat (limited to 'scripts/wait-for.sh')
-rwxr-xr-x | scripts/wait-for.sh | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/scripts/wait-for.sh b/scripts/wait-for.sh deleted file mode 100755 index 2525821..0000000 --- a/scripts/wait-for.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/sh -# https://github.com/Eficode/wait-for.git -# MIT License - -TIMEOUT=15 -QUIET=0 - -echoerr() { - if [ "$QUIET" -ne 1 ]; then printf "%s\n" "$*" 1>&2; fi -} - -usage() { - exitcode="$1" - cat << USAGE >&2 -Usage: - $cmdname host:port [-t timeout] [-- command args] - -q | --quiet Do not output any status messages - -t TIMEOUT | --timeout=timeout Timeout in seconds, zero for no timeout - -- COMMAND ARGS Execute command with args after the test finishes -USAGE - exit "$exitcode" -} - -wait_for() { - command="$*" - if [ "$QUIET" -ne 1 ]; then echo "$0: probing host $HOST port $PORT"; fi - for i in `seq $TIMEOUT` ; do - nc -z "$HOST" "$PORT" > /dev/null 2>&1 - result=$? - if [ $result -eq 0 ] ; then - if [ "$QUIET" -ne 1 ]; then echo "$0: operation succeeded on try $i"; fi - if [ -n "$command" ] ; then - if [ "$QUIET" -ne 1 ]; then echo "$0: exec-ing command $command"; fi - exec $command - fi - exit 0 - fi - if [ "$QUIET" -ne 1 ]; then echo "$0: sleeping after try $i"; fi - sleep 1 - done - echo "$0: Operation timed out" >&2 - exit 1 -} - -while [ $# -gt 0 ] -do - case "$1" in - *:* ) - HOST=$(printf "%s\n" "$1"| cut -d : -f 1) - PORT=$(printf "%s\n" "$1"| cut -d : -f 2) - shift 1 - ;; - -q | --quiet) - QUIET=1 - shift 1 - ;; - -t) - TIMEOUT="$2" - if [ "$TIMEOUT" = "" ]; then break; fi - shift 2 - ;; - --timeout=*) - TIMEOUT="${1#*=}" - shift 1 - ;; - --) - shift - break - ;; - --help) - usage 0 - ;; - *) - echoerr "Unknown argument: $1" - usage 1 - ;; - esac -done - -if [ "$HOST" = "" -o "$PORT" = "" ]; then - echoerr "Error: you need to provide a host and port to test." - usage 2 -fi - -wait_for "$@" |