- ols_access_log = os.path.join(logsPath,siteName + '_ols.access_log')
- ols_error_log = os.path.join(logsPath,siteName + '_ols.error_log')
- if os.path.exists(ols_access_log):
- history_log_file = log_path + '/' + siteName +'_access_'+his_date+'.log'
- shutil.move(ols_access_log,history_log_file)
- if is_gzip:
- os.system('gzip {}'.format(history_log_file))
- print('|---已切割日志到:'+history_log_file+'.gz')
- else:
- print('|---已切割日志到:'+history_log_file+'.gz')
- if os.path.exists(ols_error_log):
- history_log_file = log_path + '/' + siteName +'_error_'+his_date+'.log'
- shutil.move(ols_error_log,history_log_file)
- if is_gzip:
- os.system('gzip {}'.format(history_log_file))
- print('|---已切割日志到:'+history_log_file+'.gz')
- else:
- print('|---已切割日志到:'+history_log_file+'.gz')
复制代码 在/www/server/panel/script/logsBackup 加入以上代码即可。。。
|
|