qq489498494 发表于 2018-11-16 10:56:08

python的Nginx切割脚本

#!/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,path,time,path)
  

  
if os.system(command) == 0:
  
      print 'Cur access_log is compelete!',time
  
else:
  
      print 'Cur access_log is Failed'


页: [1]
查看完整版本: python的Nginx切割脚本