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

前端 未结 6 1115
半阙折子戏
半阙折子戏 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:24

    The use of backticks ` ` is outdated. Use $( ) instead:

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

提交回复
热议问题