Sindbad~EG File Manager
#!/usr/lib/rads/venv/bin/python3
from datetime import datetime
import logging
import os
import sys
import eximparse
# exit 2 = parsing problem
# exit 15 = failure to detect the installed mail system
logfile = "/opt/dedrads/mailparse/parser.log"
logging.basicConfig(
filename=logfile,
level=logging.INFO,
format='%(asctime)s [%(levelname)s] %(message)s',
)
if os.path.exists("/sbin/exim"):
print(f"{datetime.now():%Y-%m-%d %H:%M:%S} parsing exim...")
logging.info("Begin parsing exim_mainlog...")
try:
eximparse.parse_exim()
except Exception as e:
print(f"{datetime.now():%Y-%m-%d %H:%M:%S}: {e}")
logging.exception("Error during exim_mainlog parsing")
sys.exit(2)
print(f"{datetime.now():%Y-%m-%d %H:%M:%S} finished parsing exim_mainlog")
logging.info("Finished parsing exim_mainlog")
else:
print("didnt find a mail system")
logging.warning("Unable to identify mail system")
sys.exit(15)
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists