I have run into a bit of a problem with my bash script. My script among other things is starting a server that takes some time to get going. In order to combat the long startup, I have put in a while loop that queries the server to see if its running yet.
while [ $running -eq 0 ]; do
echo "===" $response "===";
if [ "$response" == "" ] || [ "$response" == *"404 Not Found"* ]; then
sleep 1;
response=$(curl $ip:4502/libs/granite/core/content/login.html);
else
running=1;
fi
done
When exiting the loop $response equals the "404" string. If thats the case, the thing should still be in the loop, shouldn't it? Seems my loop is exiting prematurely.
Joe
[ .. ]
doesn't match by glob. Use [[ .. ]]
:
if [ "$response" == "" ] || [[ "$response" == *"404 Not Found"* ]]; then
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With