用SHELL脚本精准清除Squid缓存
来源:互联网 发布:看台湾电视直播软件 编辑:程序博客网 时间:2024/05/22 00:07
此脚本是在张宴的缓存清理脚本上做了修改的,主要是增加if选项,并根据$1参数类型来选择性的列出缓存文件所在地址(因为$1并不固定,有时是特定的jpg类型,有时是域名)目前在自己的Squid缓存服务器上应用,感觉采集缓存网址基本上没什么误差了,欢迎大家试用,争取将此脚本做到更加完美(此脚本在Centos5.4 x86_64,Squid2.7下通过)脚本内容如下:
- #!/bin/sh
- squidcache_path="/usr/local/squid/var/cache"
- squidclient_path="/usr/local/squid/bin/squidclient"
- #grep -a -r $1 $squidcache_path/* | strings | grep "http:" | awk -F 'http:' '{print "http:"$2;}' | awk -F\' '{print $1}' > cache.txt
- if [[ "$1" == "swf" || "$1" == "png" || "$1" == "jpg" || "$1" == "ico" || "$1" == "gif" || "$1" == "css" || "$1" == "js" || "$1" == "html" || "$1" == "shtml" || "$1" == "htm" ]]; then
- grep -a -r .$1 $squidcache_path/* | strings | grep "http:" | awk -F 'http:' '{print "http:"$2;}' | awk -F\' '{print $1}' | grep "$1$" | uniq > cache.txt
- else
- grep -a -r $1 $squidcache_path/* | strings | grep "http:" | awk -F 'http:' '{print "http:"$2;}' | awk -F\' '{print $1}' | uniq > cache.txt
- fi
- cat cache.txt | while read LINE
- do
- $squidclient_path -p 80 -m PURGE $LINE
- done
本文出自 “抚琴煮酒” 博客,请务必保留此出处http://blog.chinaunix.net/uid-12924167-id-3193164.html
- 用SHELL脚本精准清除Squid缓存
- shell脚本清除squid缓存
- 清除指定squid缓存文件的脚本
- 清除指定squid缓存文件的脚本[原创]
- 清除指定squid缓存文件的脚本[原创]
- 【转贴】清除指定squid缓存文件的脚本
- 使用Shell脚本批量清除Nginx缓存
- firefox刷新会清除squid缓存
- linux下 squid 手动清除缓存
- 清除Squid缓存的小工具
- squid php清除缓存(4)
- 找到一款批量清除Squid缓存的小工具
- nginx根据日志清除缓存脚本
- 挺有用的清除缓存bat脚本
- 自动清除日期目录shell脚本
- 清除系统日志的shell脚本
- ES 集群清除索引 shell 脚本
- linux清除tomcat日志文件Shell脚本
- uva 537
- Struts2的工作原理1
- Centos 6.X的NFS配置
- 学java,选择传智播客java培训的8大理由
- lsof常见用法--统计打开文件数
- 用SHELL脚本精准清除Squid缓存
- Javascript学习笔记(一)
- HDU 1281
- linux系统下安装apache、tomcat以及JDK
- hdu 1562 Guess the number
- 这几天调串口遇到的问题
- 面试过程中遇到的几个简单的算法
- Andrew Stankevich's Contest #10 Solution
- TD中查询出错: Operation not allowed: <Schema>.<Table> table header has invalid partitioning.