turboci-admin/src/cron/index.ts
2026-03-12 03:56:24 +00:00

27 lines
674 B
TypeScript

import { AppData } from "@/src/data/app-data";
import cronCheckServices from "./functions/check-services";
import { watchFile } from "fs";
import path from "path";
import { execSync } from "child_process";
if (process.env.NODE_ENV !== "production") {
watchFile(path.resolve(__dirname, "../db/db-schema.js"), (curr, prev) => {
execSync(`bunx nsqlite schema -t`, {
cwd: path.resolve(__dirname, "../.."),
stdio: "inherit",
});
});
}
while (true) {
console.log(`Running Cron Services ...`);
try {
await cronCheckServices();
} catch (error) {}
await Bun.sleep(AppData["CronInterval"]);
}
// export {};