diff --git a/scan_moslogs.py b/scan_moslogs.py index f559c4d..7a5d593 100755 --- a/scan_moslogs.py +++ b/scan_moslogs.py @@ -19,6 +19,11 @@ MOS_LOG_PATH = c.get("MOS", "XML_LOG_PATH") # TODO: Store and read from database or ini! LAST_PARSED_FILE = "MOSMessage-20170221-120000.xml" +if os.path.isfile(".last_file"): + with open(".last_file", "r") as f: + LAST_PARSED_FILE = f.readline().strip() + f.close() + # Scan available MOSMessage logs and collect those we still need to scan files_to_parse = [] for file in os.listdir(MOS_LOG_PATH): @@ -62,3 +67,6 @@ for file in files_to_parse: db.finish() print("") print("Last file: {}".format(last_file)) +with open(".last_file", "w") as f: + f.write(last_file) + f.close()