How to create a loop in bash that is waiting for a webserver to respond?

前端 未结 6 1117
半阙折子戏
半阙折子戏 2020-12-12 16:48

How to create a loop in bash that is waiting for a webserver to respond?

It should print a \".\" every 10 seconds or so, and wait until the server starts to respond.

6条回答
  •  [愿得一人]
    2020-12-12 17:27

    Combining the question with chepner's answer, this worked for me:

    until $(curl --output /dev/null --silent --head --fail http://myhost:myport); do
        printf '.'
        sleep 5
    done
    

提交回复
热议问题