From 4055db738cfd57bee734e756e9c2164f873c474f Mon Sep 17 00:00:00 2001 From: Ali Fahs Date: Wed, 20 Jul 2022 03:22:13 +0200 Subject: [PATCH] Adding a script to try several public ip services --- .../src/main/resources/prepare_infra_script.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/scheduling-abstraction-layer/src/main/resources/prepare_infra_script.sh b/scheduling-abstraction-layer/src/main/resources/prepare_infra_script.sh index fa1ef652..7dae2c4a 100644 --- a/scheduling-abstraction-layer/src/main/resources/prepare_infra_script.sh +++ b/scheduling-abstraction-layer/src/main/resources/prepare_infra_script.sh @@ -1,8 +1,20 @@ PROVIDED_PORT_NAME=$variables_providedPortName if [[ ! -z $PROVIDED_PORT_NAME ]]; then - IP_ADDR=$(dig +short myip.opendns.com @resolver1.opendns.com) - echo Public adress: $IP_ADDR + + wget -q https://raw.githubusercontent.com/ow2-proactive/utility-scripts/main/network-scripts/Get_public_ip.sh && chmod +x Get_public_ip.sh || { echo "failed to download the IP script"; exit 1; } + IP_ADDR=`./Get_public_ip.sh` + CODE=$? + echo "The Public IP was retreived with code: $CODE" + + if [[ $CODE -lt 6 ]] + then + echo Public adress: $IP_ADDR + else + echo "Getting the Public IP failed!" + echo "The recieved IP: $IP_ADDR" + exit 1 + fi echo "$IP_ADDR" > $PROVIDED_PORT_NAME"_ip" fi \ No newline at end of file -- GitLab