awips2/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/logPurge.py
Steve Harris b55a488ed8 Merging SS OB12.2.1 into ss_sync
Former-commit-id: 8da36046de [formerly c8aae98741] [formerly 54be9660f1 [formerly 60f30af0c9e3203e2ff623d420165201dff41601]]
Former-commit-id: 54be9660f1
Former-commit-id: 4450cf8963
2012-02-22 11:14:43 -06:00

18 lines
666 B
Python

import os, shutil, time
from com.raytheon.edex.plugin.gfe.config import IFPServerConfigManager
import siteConfig
import LogStream
def main():
path = siteConfig.GFESUITE_LOGDIR+"/"
if(os.path.exists(path)):
purgeAge = IFPServerConfigManager.getServerConfig(siteConfig.GFESUITE_SITEID).logFilePurgeAfter()
duration = 86400 * purgeAge
cutoffTime = time.strftime("%Y%m%d", time.gmtime(time.time() - duration))
LogStream.logEvent("Purging GFE log files older than", purgeAge, "days")
dirList = os.listdir(path)
for fname in dirList:
if fname < cutoffTime:
shutil.rmtree(path + fname)