Cronjob not running
mtlballer opened this issue · comments
mtlballer commented
Script no longer runs automatically, but still works manually. The log shows the error below. Feel like I'm missing something simple but I can't currently find it.
This typically means that you attempted to use functionality that needed
the current application. To solve this, set up an application context
with app.app_context(). See the documentation for more information.
Job "maintenance (trigger: cron[month='*', day='*', day_of_week='*', hour='4', minute='0'], next run at: 2023-12-16 04:00:00 EST)" raised an exception
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/apscheduler/executors/base.py", line 125, in run_job
retval = job.func(*job.args, **job.kwargs)
File "/app/app/scripts.py", line 2044, in maintenance
from app import db, module
File "/app/app/module.py", line 19, in <module>
config = Plex.query.filter(Plex.id == '1')
File "/usr/local/lib/python3.9/site-packages/flask_sqlalchemy/model.py", line 31, in __get__
cls, session=cls.__fsa__.session() # type: ignore[arg-type]
File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/scoping.py", line 211, in __call__
sess = self.registry()
File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/_collections.py", line 639, in __call__
key = self.scopefunc()
File "/usr/local/lib/python3.9/site-packages/flask_sqlalchemy/session.py", line 102, in _app_ctx_id
return id(app_ctx._get_current_object()) # type: ignore[attr-defined]
File "/usr/local/lib/python3.9/site-packages/werkzeug/local.py", line 513, in _get_current_object
raise RuntimeError(unbound_message) from None
RuntimeError: Working outside of application context.
This typically means that you attempted to use functionality that needed
the current application. To solve this, set up an application context
with app.app_context(). See the documentation for more information.
Rafkat Abaev commented
I can confirm that cronjob is not working for me either. I've tried to define both formats in settings (e.g. 10:00, 0 10 * * *).
zbinkster commented
Mine no longer works either. I did happen to look and this directory doesnt exist for me "/usr/local/lib/python3.9". Is it there for you?
Rafkat Abaev commented
Mine no longer works either. I did happen to look and this directory doesnt exist for me "/usr/local/lib/python3.9". Is it there for you?
It does exist in my setup.