web监控,if 语句

Posted on 2017-05-17 17:15  tdtdttdd  阅读(197)  评论(0)    收藏  举报

对页面的测试  curl

if [ "`curl -I -s -o /dev/null -w "%{http_code}\n" http://10.0.0.7"` = "200"]
#if [`curl -I http://10.0.0.7 &>/dev/null|head -l|grep 200|wc -l` -eq 1]
#-curl -s http://10.0.0.7 &> /dev/null
#-if [ $? -eq 0 ]
#if [ "`curl -s http://10.0.0.7 &> /dev/null&& echo $?`" = "0" ]
#if [ "`curl -s http://10.0.0.7`" = "bbs" ]
 then
    echo "http is running"
 else
    echo "http is stopped"
fi

if

  条件

then

  执行

elif

  条件

then

  执行

fi

 

博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3