2024-12-10 16:54:43 +01:00
|
|
|
from apscheduler.schedulers.background import BackgroundScheduler
|
|
|
|
from apscheduler.triggers.interval import IntervalTrigger
|
|
|
|
from apscheduler.triggers.cron import CronTrigger
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scheduler = BackgroundScheduler()
|
|
|
|
if bool(os.getenv("BACKGROUND_SCRIPTS_RUN", 0)):
|
|
|
|
print("run")
|
|
|
|
scheduler.start()
|
|
|
|
|
|
|
|
|
|
|
|
#example
|
|
|
|
from scripts.example import test_function
|
2024-12-10 16:57:09 +01:00
|
|
|
scheduler.add_job(test_function, trigger=IntervalTrigger(seconds=60))
|
2024-12-10 16:54:43 +01:00
|
|
|
#end example
|