Skip to content

Commit

Permalink
Update wait-for-fluentd.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-Haslam authored Jan 12, 2021
1 parent 969f548 commit fd8248d
Showing 1 changed file with 33 additions and 25 deletions.
58 changes: 33 additions & 25 deletions secrets/wait-for-fluentd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,45 @@ foo(){
HTTPSTATUS=`echo $HEADERS | grep HTTP | cut -d' ' -f2`

# Check curl status
while [ $CURLSTATUS -eq 28 ]
while [[ $CURLSTATUS -eq 28 || $CURLSTATUS -eq 7 ]]
do
echo "fluentd not ready yet"
sleep 4s
sleep 2s
HEADERS=`curl -Is --connect-timeout 5 $host`
CURLSTATUS=$?
done

# check HTTP status is not empty
while [ -z "$HTTPSTATUS" ]
do
echo "fluentd not ready yet"
sleep 4s
HEADERS=`curl -Is --connect-timeout 5 $host`
HTTPSTATUS=`echo $HEADERS | grep HTTP | cut -d' ' -f2`
done

# Check HTTP status code
while [ $HTTPSTATUS -ne 200 ]
do
echo "fluentd not ready yet"
sleep 4s
HEADERS=`curl -Is --connect-timeout 5 $host`
HTTPSTATUS=`echo $HEADERS | grep HTTP | cut -d' ' -f2`
done


echo "Alright, fluentd is ready"
echo "http status = $HTTPSTATUS"
# echo $cmd
exec $cmd

if [ $CURLSTATUS -eq 0 ]
then

# check HTTP status is not empty
while [ -z "$HTTPSTATUS" ]
do
echo "fluentd not ready yet"
sleep 2s
HEADERS=`curl -Is --connect-timeout 5 $host`
HTTPSTATUS=`echo $HEADERS | grep HTTP | cut -d' ' -f2`
done

# Check HTTP status code
while [ $HTTPSTATUS -ne 200 ]
do
echo "fluentd not ready yet"
sleep 2s
HEADERS=`curl -Is --connect-timeout 5 $host`
HTTPSTATUS=`echo $HEADERS | grep HTTP | cut -d' ' -f2`
done

echo "Alright, fluentd is ready"
echo "http status = $HTTPSTATUS"
# echo $cmd
exec $cmd

else
echo 'Error bad CURLSTATUS'
echo $CURLSTATUS
fi

}

Expand Down

0 comments on commit fd8248d

Please sign in to comment.