From 94a56d049a4a22b6f8d7c93a17aa664fe4a89f23 Mon Sep 17 00:00:00 2001 From: Christian Fehmer Date: Thu, 30 Nov 2023 20:22:15 +0100 Subject: wip --- backend/src/jobs/run-standalone.ts | 9 +++++++++ backend/src/server.ts | 8 +++++--- 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 backend/src/jobs/run-standalone.ts diff --git a/backend/src/jobs/run-standalone.ts b/backend/src/jobs/run-standalone.ts new file mode 100644 index 000000000..6433989ca --- /dev/null +++ b/backend/src/jobs/run-standalone.ts @@ -0,0 +1,9 @@ +import jobs from "../jobs"; +import Logger from "../utils/logger"; +import "dotenv/config"; + +if (process.env.STANDALONE_JOBS === "YES") { + Logger.info("Starting cron jobs..."); + jobs.forEach((job) => job.start()); + Logger.success("Cron jobs started"); +} diff --git a/backend/src/server.ts b/backend/src/server.ts index 01309c352..b09819778 100644 --- a/backend/src/server.ts +++ b/backend/src/server.ts @@ -59,9 +59,11 @@ async function bootServer(port: number): Promise { ); } - Logger.info("Starting cron jobs..."); - jobs.forEach((job) => job.start()); - Logger.success("Cron jobs started"); + if (process.env.STANDALONE_JOBS !== "YES") { + Logger.info("Starting cron jobs..."); + jobs.forEach((job) => job.start()); + Logger.success("Cron jobs started"); + } recordServerVersion(version); } catch (error) { -- cgit v1.2.3