#!/usr/bin/env python #date:2015-06 #Author:ley #Cur the nginx‘s access_log #-*-coding:UTF-8-*- import os,time path=[‘/var/log/nginx/‘,‘/var/run/nginx/nginx.pid‘,‘access.log‘] time=time.strftime(‘%Y-%m-%d‘) command="cd %s && /bin/cp %s %s && /bin/kill -USR1 `cat %s`" % (path[0],path[2],time,path[1]) if os.system(command) == 0: print ‘Cur access_log is compelete!‘,time else: print ‘Cur access_log is Failed‘
本文出自 “梁恩宇-9527” 博客,转载请与作者联系!
原文地址:http://liangey.blog.51cto.com/9097868/1662158