#!/usr/bin/env python
#-*-coding:utf-8-*-
import os,datetime
cur_date = datetime.datetime.now().strftime('%Y-%m-%d')
directory='/u01/app/oracle/diag/tnslsnr/nick-testdb/listener/trace/'
size=os.path.getsize('/u01/app/oracle/diag/tnslsnr/nick-testdb /listener/trace/listener.log')
size=size/1024/1024
if size > 10: #1536:
os.chdir(directory)
os.getcwd()
os.system('lsnrctl set log_status off && mv listener.log listener.log.%s && lsnrctl set log_status on' %cur_date)
else:
print 'No need to regenerate lisener.log'
oracle用戶的crontab任務
0 2 * * 7 /usr/bin/python /home/oracle/run/re_lisener_log.py /home/oracle/run/re_listener.log 2>&1
网友评论