zoukankan      html  css  js  c++  java
  • 批量检查多个网址是否正常(shell编程)

    #!/bin/bash
    #version 1.1
    #by zengj
    #using checking urls
    
    . /etc/init.d/functions
     checkurl() {
         wget -o /dev/null -T 3 --tries 1 --spider $1 > /dev/null 2>&1
           if [ $? -eq 0 ]
             then
                action "this $1 is true" /bin/true
             else
                action "this $1 is bad" /bin/false
           fi
    }
     wait() {
         for((i=0;i<3;i++))
          do
            if [ $i -eq 2 ]
             then
               echo "."
             else
               echo -n "."
               sleep 2
            fi
          done
    }
      main(){
        array=(http://blog.oldboydu.com
               http://blog.etiantian.org
               http://oldboy.blog.51cto.com
               http://10.0.0.7
               http://www.baidu.com
    )
        while(true)
        do
         echo "------this NO.$((++num)) checkurling------"
         for url in ${array[*]}
           do
             wait
             checkurl $url
           done
             sleep 10
          echo " "
        done
    }
    main
    

      

  • 相关阅读:
    sunjiali
    dingding
    xlrd
    Python基础2
    Python常用算法学习
    Python基础1
    分布式监控系统
    堡垒机
    通过Python实现简单的计算器
    Python常用模块学习
  • 原文地址:https://www.cnblogs.com/zengjieboke/p/7101996.html
Copyright © 2011-2022 走看看