Former-commit-id:a02aeb236c
[formerly9f19e3f712
] [formerly06a8b51d6d
[formerly 64fa9254b946eae7e61bbc3f513b7c3696c4f54f]] Former-commit-id:06a8b51d6d
Former-commit-id:3360eb6c5f
21 lines
834 B
Python
21 lines
834 B
Python
|
|
import os, shutil, time
|
|
from com.raytheon.edex.plugin.gfe.config import IFPServerConfig
|
|
from com.raytheon.edex.plugin.gfe.config import IFPServerConfigManager
|
|
from com.raytheon.uf.edex.database.purge import PurgeLogger
|
|
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)
|
|
dirList.sort()
|
|
toDelete = []
|
|
for fname in dirList:
|
|
if fname < cutoffTime:
|
|
shutil.rmtree(path + fname)
|