diff options
-rw-r--r-- | backend/src/jobs/run-standalone.ts | 9 | ||||
-rw-r--r-- | backend/src/server.ts | 8 |
2 files changed, 14 insertions, 3 deletions
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<Server> { ); } - 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) { |