zoukankan      html  css  js  c++  java
  • nginx 完成缓存清除 以及升级包的自动升级

    #!/bin/bash
    function cache(){
    for i in `curl xxx.fe.xxx.cn/uplist.txt`;do
      url=`echo $i|awk -F"#" '{print $1}'`
      md5=`echo $i|awk -F"#" '{print $2}'`
      file_name=`echo $url|awk -F'/' '{print $NF}'`
      cd /tmp;curl -O $url -x 127.0.0.1:80
      if [ "`md5sum /tmp/$file_name|awk '{print $1}'`" == "$md5" ];then
        echo "$file_name is ok"
      elif [ "`md5sum /tmp/$file_name|awk '{print $1}'`" != "$md5" ];then
        echo "$file_name is fail"
        FILE=`echo $i|awk -F"#" '{print $1}' |awk -F '/' '{print $3}'`
        CACHE_DIR=/xdfapp/data/cache/
        echo "The file : $FILE to be clean nginx Cache ,please waiting ....."
        for h in `echo $FILE `;do
            grep -ra  $h  ${CACHE_DIR}| awk -F':' '{print $1}'  > /tmp/cache_list.txt
            for j in `cat /tmp/cache_list.txt`;do
                    rm  -rf  $j
                    echo "$h  $j  is  Deleted Success !"
            done
        done
        echo "echo "$h  $j  is  Deleted Success !""
        curl -O $url -x 127.0.0.1:80
        [ $? -ne 0 ]  && echo "Download fail!" && exit 1
      else
        echo "$file_name is fail------"
      fi
    done
    }
    cache
    

      

  • 相关阅读:
    linux 运维
    mariadb replication
    phpmyadmin
    Objective-C设计模式——单例Singleton(对象创建)
    收藏iOS学习资料
    axios拦截器
    vue单页面优化
    html设置http缓存代码
    js数组去重,排序的几种方法
    前端移动端问题
  • 原文地址:https://www.cnblogs.com/lixinliang/p/9252783.html
Copyright © 2011-2022 走看看