web监控,if 语句

时间:2023-03-08 17:08:59

对页面的测试  curl

if [ "`curl -I -s -o /dev/null -w "%{http_code}\n" http://10.0.0.7"` = ""]
#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 ]
#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