2019-08-09 12:20:13 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# -*-coding:UTF-8 -*
|
|
|
|
"""
|
2019-09-11 13:33:04 +00:00
|
|
|
The DbCleaner Module
|
2019-08-09 12:20:13 +00:00
|
|
|
===================
|
|
|
|
|
|
|
|
"""
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import time
|
|
|
|
import datetime
|
|
|
|
|
2021-06-08 14:46:36 +00:00
|
|
|
sys.path.append(os.environ['AIL_BIN'])
|
|
|
|
##################################
|
|
|
|
# Import Project packages
|
|
|
|
##################################
|
2019-08-09 12:20:13 +00:00
|
|
|
|
2021-06-08 14:46:36 +00:00
|
|
|
from pubsublogger import publisher
|
|
|
|
|
2019-08-09 12:20:13 +00:00
|
|
|
if __name__ == "__main__":
|
|
|
|
|
|
|
|
publisher.port = 6380
|
|
|
|
publisher.channel = "Script"
|
|
|
|
publisher.info("DbCleaner started")
|
|
|
|
|
|
|
|
# low priority
|
|
|
|
time.sleep(180)
|
|
|
|
|
|
|
|
daily_cleaner = True
|
|
|
|
current_date = datetime.datetime.now().strftime("%Y%m%d")
|
|
|
|
|
|
|
|
while True:
|
|
|
|
|
|
|
|
if daily_cleaner:
|
2023-05-04 14:35:56 +00:00
|
|
|
|
2019-08-09 12:20:13 +00:00
|
|
|
daily_cleaner = False
|
|
|
|
else:
|
|
|
|
sys.exit(0)
|
|
|
|
time.sleep(600)
|
|
|
|
|
|
|
|
new_date = datetime.datetime.now().strftime("%Y%m%d")
|
|
|
|
if new_date != current_date:
|
|
|
|
current_date = new_date
|
|
|
|
daily_cleaner = True
|