# -*- coding: utf-8 -*-
"""اجرای کارهای دوره‌ای (بررسی انقضا/حذف سرویس‌ها، بکاپ دیتابیس). هر ۱ تا ۳ دقیقه با Cron Job."""
import os
import sys

BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, BASE_DIR)
os.chdir(BASE_DIR)
for _s in (sys.stdout, sys.stderr):
    try:
        _s.reconfigure(encoding="utf-8", errors="replace")
    except Exception:
        pass

import bot_core as core  # noqa: E402

if __name__ == "__main__":
    print(core.run_cron_tick())
    sys.stdout.flush()
    sys.stderr.flush()
    os._exit(0)
