
正文
shell检测网站地址是否存活
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
#!/bin/bash
. /etc/init.d/functions
url_list=(www.baidu.com)
ChkCurl(){
i=0
while [ $i -lt 2 ]
do
curl http://${url_list[$i]} &>/dev/null
if [ $? -eq 0 ];then
action "${url_list[$i]}" /bin/ture
else
action "${url_list[$i]}" /bin/false
fi
let i++ done
}
main(){
while true
do
ChkCurl
sleep 3done
}
main








