2023-02-07 05:55:36 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
WAIT_FOR_URL="$1"
|
|
|
|
shift
|
2023-02-07 06:15:20 +00:00
|
|
|
LOGS_PATH="$1"
|
|
|
|
shift
|
2023-02-07 05:55:36 +00:00
|
|
|
|
2023-02-07 06:09:38 +00:00
|
|
|
attempt=0
|
2023-02-07 06:35:10 +00:00
|
|
|
while [ $attempt -le 120 ]; do
|
2023-02-07 06:09:38 +00:00
|
|
|
attempt=$(( $attempt + 1 ))
|
|
|
|
echo "# Waiting for all services to be up (attempt: $attempt) ..."
|
|
|
|
ping_api_gateway_result=`curl -s $WAIT_FOR_URL | grep "Welcome"`
|
|
|
|
if [ "$?" -eq "0" ]; then
|
|
|
|
sleep 2 # for warmup
|
|
|
|
echo "# All services are up!"
|
2023-02-07 06:15:20 +00:00
|
|
|
exit 0
|
2023-02-07 06:09:38 +00:00
|
|
|
break
|
|
|
|
fi
|
|
|
|
sleep 2
|
2023-02-07 05:55:36 +00:00
|
|
|
done
|
2023-02-07 06:15:20 +00:00
|
|
|
|
|
|
|
echo "# Failed to wait for all services to be up!"
|
|
|
|
|
|
|
|
echo "# Errors:"
|
2023-02-07 09:22:04 +00:00
|
|
|
tail -n 50 $LOGS_PATH/*.err
|
2023-02-07 06:15:20 +00:00
|
|
|
|
|
|
|
echo "# Logs:"
|
2023-02-07 09:22:04 +00:00
|
|
|
tail -n 50 $LOGS_PATH/*.log
|
2023-02-07 06:51:53 +00:00
|
|
|
|
|
|
|
exit 1
|