#!/usr/bin/python #-*-coding:UTF-8-*- import time import os logdir='/data/log/nginx' nginxpath='XX/logs/nginx.pid' end_dir='/data/log/oldlog/' str = time.strftime('%Y%m%d') print str tar_conn1 = "/bin/mv %s %s%s && /bin/mkdir -p %s && /bin/kill -USR1 `cat %s`" % (logdir,end_dir,str,logdir,nginxpath) if os.system(tar_conn1) == 0: print '切割成功', str else: print 'Error,操作失败'