检测网站地址是否存活

1、检测网站地址是否存活

#!/bin/bash
. /etc/init.d/functions
url_list=(www.tec.com www.stu.com)

function chkurl(){
i=0
while [ $i -lt 2 ]
do
  curl http://${url_list[$i]} &>/dev/null
  if [ $? -eq 0 ]
  then
    action "${url_list[$i]}" /bin/true
  else
    action "${url_list[$i]}" /bin/false
  fi
  let i++
done
}

function main(){
while true
do chkurl
   sleep 3
done
}
main
发布了35 篇原创文章 · 获赞 11 · 访问量 2980

猜你喜欢

转载自blog.csdn.net/weixin_45697805/article/details/101623929
今日推荐