#!/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'