首页 > 代码库 > nginx 批量删除cache

nginx 批量删除cache

#!/bin/sh

#auth by yx 20140808

#purge nginx cache

CACHE_DIR="/data/web/cache"

FILE="$*"

if [ $# -eq 0 ];then

    echo "please run \"sh $0 index.html index.jsp ....\""

    exit

fi

for i in `echo $FILE`

do

    grep -ra $i ${CACHE_DIR}| awk -F ":" ‘{print $1}‘ >./cache_list.txt

    for j in `cat ./cache_list.txt`

    do

rm -rf $j

    done

done