Linux script with curl to check webservice is up

后端 未结 6 794
难免孤独
难免孤独 2021-01-30 17:05

I have a webservice provided at http://localhost/test/testweb

I want to write a script to check if webservice is up with curl

If there a curl parame

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-30 17:15

    That will check the headers via wget 2>&1pipes the stderr to stdout grep filters -O /dev/null just throws the content of the page

    if [ "\`wget http://example.org/ -O /dev/null -S --quiet 2>&1 | grep '200 OK'\`" != "" ]; 
    then 
       echo Hello; 
    fi;
    

    I know not curl, but still a solution

提交回复
热议问题