python删除nginx反响代理缓存代码,pythonnginx,#!/usr/bin/e
文章由Byrx.net分享于2019-03-23 10:03:12
python删除nginx反响代理缓存代码,pythonnginx,#!/usr/bin/e
#!/usr/bin/env python'''Clear nginx a url cache'''import ostry: from hashlib import md5except: from md5 import md5url=raw_input('Please enter url : ')isClr=raw_input("You sure you want to clear '%s' cache ? (y/n) " % url)if isClr=='y' or isClr=='Y' : m=md5() m.update("%s" % url) md5url=m.hexdigest() md5urllen=len(md5url) dir1=md5url[md5urllen-1:] dir2=md5url[md5urllen-3:md5urllen-1] dirPath=("/usr/local/nginx/proxy_cache/%s/%s/%s" % (dir1, dir2, md5url)) isDel=raw_input("Will be deleted : %s (y/n) " % dirPath) if isDel=='y' or isDel=='Y' : if(os.path.exists(dirPath)) : os.remove(dirPath) print 'delete success' else : print 'file not find'
相关内容
- 根据目录下的文件名生成SQL语句,文件名生成sql语句
- Python telnet服务器,pythontelnet服务器,import threa
- python htmldecode替换html实体,pythonhtmldecode,如下代码使用
- 抓取指定网页以及该网页上所有链接,抓取指定网页链
- windows下清理svn文件夹的python脚本,svnpython,# -*- coding
- Python 126邮箱自动登录程序,python126,import sys,
- Python汉字转拼音,python汉字拼音,# -*- coding
- 动态规划算法,计算单词距离,动态规划算法单词,#!/u
- Python 发email 带附件,python发email附件,from email.M
- 检测图片格式,,import osimp
评论关闭