oneuptime/ScriptRunner/index.ts
Nawaz Dhandala 78bd51ad3a
fix
2022-04-15 23:14:01 +01:00

19 lines
435 B
TypeScript

import app from 'CommonServer/utils/StartServer';
import cron from 'node-cron';
import main from './workers/main';
// API
import ScriptAPI from './api/script';
app.use('/script', ScriptAPI);
const cronMinuteStartTime: $TSFixMe = Math.floor(Math.random() * 50);
// Script monitor cron job
cron.schedule('* * * * *', () => {
setTimeout(() => {
return main.runScriptMonitorsJob();
}, cronMinuteStartTime * 1000);
});