Created
March 28, 2023 20:52
-
-
Save osamaAbdullah/34665cb3022478ea0d9f649fca37df1a to your computer and use it in GitHub Desktop.
wait_for_dependencies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
SERVICES=$(echo "$DEPENDENCIES" | tr "|" "\n") | |
resolve() | |
{ | |
for SERVICE in $SERVICES; do | |
ip=$(nslookup "$SERVICE" | awk '/^Address: / { print $2 }') | |
if echo "$ip" | grep -Eq "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b"; then | |
echo "$SERVICE ===> $ip" | |
else | |
echo "can not revolve $SERVICE --XX--" | |
sleep 0.1 | |
resolve | |
fi | |
done | |
} | |
resolve | |
exec "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment