From 1e449175692602b50c7a4e3174e019e5f365db5f Mon Sep 17 00:00:00 2001 From: datechnoman Date: Tue, 9 Jan 2024 21:14:23 +0000 Subject: [PATCH] Updated cdx file retention to 2 days --- pastebin_automated_cdx_processor.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pastebin_automated_cdx_processor.py b/pastebin_automated_cdx_processor.py index 5e94048..842d217 100644 --- a/pastebin_automated_cdx_processor.py +++ b/pastebin_automated_cdx_processor.py @@ -179,13 +179,13 @@ def main(): directory_output_file.write(f"{filename}\n") # Process older files in /opt/cdxfiles/pastebin - older_than_24_hours = datetime.now() - timedelta(days=1) + older_than_48_hours = datetime.now() - timedelta(days=2) for filename in os.listdir(PASTEBIN_DIRECTORY): file_path = os.path.join(PASTEBIN_DIRECTORY, filename) - if filename.endswith(".cdx.json") and os.path.getmtime(file_path) < older_than_24_hours.timestamp(): - # Delete the JSON file if it's older than 24 hours + if filename.endswith(".cdx.json") and os.path.getmtime(file_path) < older_than_48_hours.timestamp(): + # Delete the JSON file if it's older than 48 hours os.remove(file_path) - print(f"Deleted '{filename}' as it is older than 24 hours.") + print(f"Deleted '{filename}' as it is older than 48 hours.") run_ia_command() # Run IA command after processing older files