客户经常要求清除缓存 由于CDN后台只能支持单个url的 所以目录级别的只能用脚本
example:清除 www.123.com 下所以的缓存
1 #!/bin/bash 2 3 TODAY=`date +%Y.%m.%d` 4 YESTERDAY=`date -d "-1 days" +%Y.%m.%d` 5 6 Slogdir="/data/squid/log" 7 8 squidclient_path="/usr/sbin/squidclient" 9 Today_log="$Slogdir/store.log.$TODAY" 10 Yesterday_log="$Slogdir/store.log.$YESTERDAY" 11 12 awk '/www.123.com/ {print $NF}' ${Today_log} ${Yesterday_log} | sort | uniq | 13 while read cache 14 do 15 $squidclient_path -p 80 -m PURGE $cache 16 done