peiyuan1030 发表于 2018-8-22 09:35:21

企业Shell实战-批量检查多个网站地址是否正常

# cat ms6.sh  
#!/bin/bash
  
[ -f /etc/init.d/functions ] && source /etc/init.d/functions
  
#define array url list
  
array=(
  
http://www.etiantian.org
  
http://www.taobao.com
  
http://oldboy.blog.51cto.com
  
http://10.0.0.7
  
)
  
#check_url
  
wait(){
  
echo -n "wait 3s"
  
for((i=0;i/dev/null
  
RETVAL=$?
  
if [ $RETVAL -eq 0 ];then
  
      action "check $1"/bin/true
  
else
  
      action "check $1"/bin/false
  
fi
  
return $RETVAL
  
}
  
main(){
  
wait
  
for((i=0;i
页: [1]
查看完整版本: 企业Shell实战-批量检查多个网站地址是否正常