diff --git a/app.py b/app.py index 1c97743..9335448 100644 --- a/app.py +++ b/app.py @@ -1,3 +1,4 @@ +import argparse import atexit import http import inspect @@ -185,8 +186,15 @@ def exit_safety() -> None: app.register_blueprint(apiBP) if __name__ == '__main__': + + parser = argparse.ArgumentParser(description="Background Scheduler") + parser.add_argument('--interval', type=int, default=10, help="Interval in minutes") + args = parser.parse_args() + atexit.register(exit_safety) + scheduler = BackgroundScheduler() - scheduler.add_job(generic_executor.scheduled_actions, 'interval', minutes=10) + scheduler.add_job(generic_executor.scheduled_actions, 'interval', minutes=args.interval) scheduler.start() + app.run(host='0.0.0.0', port=3000, debug=False)